How to fetch alphanumeric string from table


Assume that you have a table which contains alphabetic, numeric, alphanumeric string, and special characters and you are asked to fetch only alphanumeric string from those strings. Following is the sample table named Numbers which…

 201 total views,  1 views today

Read More...

Difference between clustered index and non clustered index


SQL Server indexes are used by queries to find data values quickly in tables and views. Basically it speed up the queries performance. You can also relate a SQL Server Indexes with any text book…

 572 total views,  6 views today

Read More...

How to Update from Select Statement in SQL


SQL Server update statement is used used to modify an existing records in a table, you can also update records in table based on some specific conditions. Following is the basic syntax of update statement….

 614 total views,  1 views today

Read More...

Insert multi language data in table


Sometimes, you need to store multi language or multilingual data in any table column. Inserting a multilingual data into column without following some basics rules, you see that when you select data from table, it…

 383 total views,  2 views today

Read More...

How to insert the result of a stored procedure into table


Sometimes, you want to store the result of a stored procedure into table or temp table instead of returning the output. Storing output of stored procedure into table enables more option for you, such as…

 733 total views,  5 views today

Read More...

Date and Time Conversions in SQL Server


Sometimes you need to format a date in specific format such as format a date time string YYYY-MM-DD hh:mm:ss. mmm to date MM:DD:YY. SQL Server provides you a various options that you can use to…

 342 total views,  2 views today

Read More...

Get Row Counts for all tables in SQL Server


Sometime you are required to validate the row counts for each tables in database. So getting a row counts for each tables either through using a loop on each table or go and get row…

 708 total views,  13 views today

Read More...

Script table in SQL Server


You can script a table from database using a SQL Server Management Studio. SQL Server Management allows you to script out tables from database using a Script table as option. This option can be used…

 73 total views,  1 views today

Read More...

Generate Database Scripts With Data in SQL Server


You can generate a database scripts including the schema and the data by using the Generate Scripts option available in SQL Server Management Studio (SSMS), which generates a scripts for selected database. When you perform…

 337 total views,  3 views today

Read More...

Table Value Constructor


Table Value Constructor (TVC) allows to group multiple rows of data in a single DML statement. It can be used as a part of either the VALUES clause of an INSERT INTO VALUES statement, or…

 305 total views

Read More...

How to get TOP N records for each category


Selecting a top n records for each category from any table, can be done easily using row_number function which generates a sequential integer to each row within a partition of a result set. To understand…

 209 total views,  2 views today

Read More...

IDENT_CURRENT Function


The IDENT_CURRENT function returns the last IDENTITY value generated for any specific table or view on an identity column in any session and any scope. This function is limited only to a specific table or…

 158 total views,  3 views today

Read More...

Separate numbers, letters and special characters from string


How to find and separate the numbers, letters and special characters from string? Suppose you a column in table which contains a mix words which may includes numbers, letters, and special characters, or either numbers…

 247 total views,  4 views today

Read More...

How to Encrypt a Stored Procedure in SQL Server


Encrypting a SQL Server Stored Procedure If you have any complex business logic that you want to keep secure and hide from end user due to some security reasons then you can encrypt SQL Server…

 473 total views,  4 views today

Read More...

SQL change column collation to case sensitive


How to change the Collation of table column to Case insensitive or Case sensitive? Lets prepare a sample table called DumpData, and insert few records as shown below. CREATE Table dbo.DumpData (ID INT, Name VARCHAR(50)…

 572 total views,  3 views today

Read More...

Copy or delete files from directory in SQL Server


How to copy or delete files from directory in SQL Server ? It can be done using xp_cmdshell which is SQL Server built in system stored procedure is used to commands directly in the windows…

 515 total views,  1 views today

Read More...

Get a last access time for tables in SQL Server


How to get a last access time for tables in SQL Server ? To get the last time when table was accessed in SQL Server, you can use SQL Server dynamic management view sys.dm_db_index_usage_stats, which…

 1,277 total views,  11 views today

Read More...