Useful SQL Server Scripts
There are many situations where in past we did some
useful functionality
in some stored procedures after that as time goes we forgot that how
exactly we had done that functionality and now we want implement that
functionality
Read More...
There are many situations where you want to list of stored procedures from your database and it's useful details like , SP created date , modify date etc.. using sql query. There is simple way to get these information using sql query. We are using "sys.procedures" system table to get list and details.
Read More...
There are many situations where you want to list of tables and it's useful details like , table created date , modify date etc.. using sql query. There is simple way to get these informations using sql query. We are using "sys.tables" system table to get list and details.
Read More...
You can get parent child hierarchy records or category sub category records or recursive records from table in sql server and display as a tree structure. We are using A common table expression (CTE) to get result. In fact we are using Recursive CTE to get this recursive data.
Read More...
You can insert value in identity column manually using INSERT statement using "IDENTITY_INSERT" property. You need to set IDENTITY_INSERT property to ON to allow identity insert value.
Read More...
here is a situations where you want to know the column names and it's data type and other column relavant information of a particular table.
Read More...
There are many situations where you want to get all tables name that contains particular column name using sql query. Here is query for this.
Read More...
You can get current database name using In Built SQL function "DB_NAME()".
Read More...
You can seen that XML is now every where to exchange data between multiple system and platform. Here are sample query which retrive XML of particular Table's data. XML support is available on SQL Server 2000 with SQLXML 3.0 and its XML extensions, and There are in built native XML data type support in SQLServer 2005 and 2008.
Read More...
Are you having a problem of store Unicode data in database table and it will display
"??????" ? Here are solution for that. SQL Server supports Unicode data in nchar, nvarchar and ntext datatypes. If you are inserting unicode data as regular data at that time sql does not store unicode characters it store "??????" (Question marks) in also display this "??????"
Read More...
Some time you Database Physical file Address and file size using sql script.
Read More...
Sometimes we have situation in which we want delete all records of table and that table containts identity column as primary key and we want again insert some new records in this table ,
so in this case identity column does not start with 1 but it start with last number that we had before deleted records.
Read More...
In some cases we need to get comma separated or any user defined separator values from table column. There are multiple solutions for that.
Read More...
There are a situation in which you want to delete duplicate records from table. Here are example in which i created on temp table and add four columns, in this three columns are data columns and one column is ID column.
Read More...
Local temporary tables are visible only in to their creators during the same connection to an instance of SQL Server as when the tables were first created or referenced. Local temporary tables are deleted after disconnects from SQL Server instance .
Read More...
If you want to use FILESTREAM data storage features in database you must create FILESTREAM enabled database.
Read More...
Here are varios functions to get system date and time.
Read More...
Following command get full SQL server version details:
Read More...
Thanks for the blog.It was Great article.
ReplyDeleteSQL training in Pune