Using xml column in sql server with XSD enabled
For a long time I was wondering about why the xml type is needed in sql server. Following are a few number of advantages on using xml column types which I found implemented in industry. We can store...
View ArticleThe system tables in Sql Server
We can use the sys.tables and sys.objects to find metadata of tables and columns. Display all User Tables select * from sys.tables – displays all user tables Display all Columns in a Table select *...
View ArticleSql Server :: Cool Sqls
Some useful sqls I am sharing here. Description Sql Get Row Number of any table SELECT ROW_NUMBER() OVER (ORDER BY Name ASC) AS ROWID, * FROM TableX Delete Duplicate Records WITH CTE (Col1,Col2,...
View ArticleHow to create Linked Server in Sql Server?
Open the Management Studio and in the Server Objects > Linked Servers, right click select New Linked Server menu. In the appearing screen enter the actual remoteserver alias name as “RS” Enter...
View ArticleAutomatic History using Triggers
I would like to take a moment to explain the following problem I am facing: I do have a table named Equity which contains the company name and the current PE Ratio. The PE Ratio will be updated daily...
View ArticleHow to shrink Sql Server Database?
The Enterprise Management studio provides an option to shrink the database. Step 1: Open Enterprise Management Studio (i am using sql server 2008) and select database, right click and choose...
View ArticleSql Server – Transact Sql to make a column unique
ALTER TABLE TableName ADD CONSTRAINT NewConstraintName UNIQUE(ColumnName)
View ArticleSQL Server–Create User / Domain User using SQL
CREATE LOGIN user1WITH PASSWORD = ’MyPassword’ USE TheDbName CREATE USER user1FOR LOGIN user1; GO CREATE LOGIN [Domain\user1] FROM WINDOWS; USE TheDbName CREATE USER user1 FOR LOGIN [Domain\user1]
View ArticleWhat is AlwaysOn in SQL Server?
SQL Server 2012 introduced the new feature called AlwaysOn. AlwaysOn provides High Availability & Disaster Recovery alternative to Database Mirroring. What is Database Mirroring? Database Mirroring...
View Article