Click here to Skip to main content
15,921,841 members
Everything / Database Development / SQL Server

SQL Server

SQL-Server

Great Reads

by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
by Jovan Popovic(MSFT)
Mapping properties in EF model to database columns that contain JSON
by Steve Krile
Fully AJAX-enabled user control used to select names from a database in a drop-down format.
by Mubin M. Shaikh
Create time dimension with 24 hour plus values and time buckets in your data warehouse

Latest Articles

by Federico Di Marco
Query Excel or CSV files with T-SQL without importing them in a table first
by Bert O Neill
This article provides an overview for developers, on how to quickly generate a dependency Entity Relationship Diagram for a table and its immediately related tables, within SQL Server.
by GabrieleTronchin
A simple stored procedure to add at your database to keep it reactive
by GabrieleTronchin
Automatic creation of non clustered indexes using system SQL entities

All Articles

Sort by Score

SQL Server 

15 Jan 2013 by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
5 Sep 2013 by Mubin M. Shaikh
Create time dimension with 24 hour plus values and time buckets in your data warehouse
19 Apr 2012 by Deepak_Sharma_
This article will show how to create an auto-suggest TextBox that will suggest data from a SQL Server database column.
21 Oct 2013 by Member 7874525
This how you can monitor your database changes
28 May 2010 by DecodedSolutions.co.uk
This is a simple article describing how to create an add an outlook appointment to your MS Outlook Calender.
27 Jan 2016 by DataBytzAI
How to refresh intellisense after adding new objects in Microsoft SQL Management Studio
16 Mar 2012 by Anurag Gandhi
A Query to copy an individual table data between databases
8 Jul 2010 by Md. Marufuzzaman
How easy to read a file without using of the seven extended stored procedures.
16 Jan 2014 by Tom Glick Philadelphia, US
POC to demonstrate passing of collections of complex objects to ASP.NET Web API Controllers.
14 Aug 2010 by Roger Wright
A simple example of creating a new database on a SQl Server instance
19 Feb 2015 by DrABELL
Technique to extend capability of standard SQL by adding the Aggregate Product Function
3 Nov 2013 by S. M. Ahasan Habib
I will explain here how to use table variable and over come cursor limitation
22 Jul 2013 by Paw Jershauge
Want your own movie database??? Download IMDB in 20 minutes.
13 Oct 2016 by Wendelius
A little tip on how to format repeating values in SQL output using LAG function
19 Feb 2019 by DiponRoy
How to do string split and join in SQL Server
19 Feb 2010 by Md. Marufuzzaman
This is good... You can also consider this link.[^]
28 Oct 2010 by Sunasara Imdadhusen
SQL Server 2005 : Generate Script with Data from Database – Database Publishing Wizard
25 Nov 2010 by Sivaraman Dhamodharan
How do you use the Template explorer and assign parameter values.
20 Feb 2012 by BillyGoatGruff
SQL Profiler is not included with SQL Express, this tip will help if you need to track client activity.
23 Feb 2012 by Mahmud Hasan
How to use variable in SELECT TOP SQL command
6 Dec 2012 by Ravi Tuvar
Concatenate rows with comma separated string in SQL.
18 Sep 2015 by Wendelius
This tip shows how to calculate a difference between two datetime values and to express the difference in years, days, hours, minutes and so on.
20 Dec 2012 by Wendelius
This tip describes how to delete duplicate rows from a table that doesn't have a key.
9 Aug 2011 by Jesus Carroll
This brief article show how to install quickly Microsoft SQL Server 2008 Express Edition Standard or with Advanced Services
13 Jan 2013 by mparvez
How to load data from an Excel file to load in a dimension table in an incremental way.
11 Oct 2013 by Brad Joss
A SQL String Split function for the real world
31 Oct 2013 by Debopam Pal
How to bring data from Entity model to Excel file using LINQ.
8 Jul 2015 by Rodrick Kazembe
This is a step by step SQL Server Stored Procedures tutorial for beginners with insert, update, delete and select examples.
11 Dec 2019 by Akmishra0719
Daily reminder using SQL Agent and SignalR
17 Sep 2012 by aasim abdullah
Get all indexes list in detail, with their involved columns
1 Feb 2013 by S. M. Ahasan Habib
.NET TransactionScope and its default Transaction Isolation level issue.
18 Dec 2015 by Md. Marufuzzaman
This tip shows you an easy way to split Microsoft SQL Server table row data.
31 Oct 2016 by Chris Maunder
Timing SQL calls with millisecond accuracy
31 Jan 2017 by #realJSOP
Using common table expressions to build data from thin air.
1 Oct 2018 by Satnam Singh CapGemini
Improving backup performance
28 Dec 2019 by Wendelius
How to overcome the error message "Types don't match between the anchor and the recursive part in column..." for varchar columns in a recursive CTE query
1 Jul 2020 by Trond Lind
Prevent brute-force login attacks on a remotely accessible SQL Server database using T-SQL
17 Feb 2011 by John Gathogo
Catastrophic results associated with unqualified use of columns belonging to tables referenced on main query in a subquery
25 Feb 2011 by pankajupadhyay29
Use this when you want to perform a task on all tables in a database
31 Aug 2014 by Wendelius
This tip demonstrates the use of LAG and LEAD functions in SQL Server.
11 Oct 2011 by Chris Maunder
A quick script to enable you to find the processes that are blocking in SQL server
18 Jun 2012 by cjb110
How to identify the cause of the DataSet Constraint Exception
17 Aug 2012 by ManojKumar19
Update row column with another row column in same table SQL only if it is null.
23 Sep 2012 by OriginalGriff
Inserting a number of rows in a database isn't difficult, but how do you do it in a single command without concatenating strings?
20 Oct 2012 by aasim abdullah
How to Refresh Intellisense Cache in SQL Server
13 Dec 2012 by Paw Jershauge
MS SQL system views, mapped over version.
19 Jan 2013 by Wendelius
This tip shows how to get rows from a table where a field contains a number that is a power of 2 using LOG function.
15 Jan 2013 by mparvez
SSIS fuzzy lookup for cleaning dirty data.
25 Sep 2014 by SERokon
OLAP cube performance optimization technique
2 Nov 2015 by Guni Van
Mapping your database with C# object class, then make typed-safe query like SQL syntax
30 Sep 2016 by Wendelius
TrimChar function which removes occurences of the desired character from both ends of a string.
7 Dec 2016 by Wendelius
This tip demonstrates how to select valid records from a table that contains validity date limits.
18 Dec 2016 by NightWizzard
Convert amounts to their spoken equivalents
4 Sep 2010 by Jaime Olivares
How to Insert or Update an SqlGeography object in SQL Server 2008 from a C# application
8 Jun 2010 by basementman
Or, assuming your table has an index, you could do this "old-school" as:select MAX(rows) from sysindexes where id = Object_ID('{tablename}')
12 Jun 2011 by Mel Padden
Default keyword in SQL Server
14 Jun 2011 by jwood_denver
Why don't you just use a query like this?SELECT CAST(serverproperty(N'servername') AS varchar(50)) AS [Server Name], db_name() AS [Database Name], SCHEMA_NAME(schema_id) AS [Schema Name], [name] AS [Object Name], [type_desc] AS [Object Type], [create_date] AS [Create...
18 Oct 2011 by Elina Blank
To see the default value of the cursor scope:select * from sys.databases(if value of "is_local_cursor_default" is 0 then scope id global, otherwise it is local).The scope is GLOBAL by default (for compatibility reasons).To change default scope use following:ALTER DATABASE...
25 Dec 2011 by PIEBALDconsult
Using a Common Table Expression to produce a list of Views, Procedures, and Functions
1 Jun 2016 by PIEBALDconsult
Interspersing 'Total' rows among summarized data rows in the correct order
20 Sep 2012 by Sreedhar Puligundla
Simple steps to create SQL joins by using SQL Server 2008 Management Studio
23 Oct 2012 by aasim abdullah
How to use DELETED and INSERTED virtual tables to capture data change in result of any INSERT, UPDATE or DELETE statement.
24 Oct 2012 by aasim abdullah
Backup and then restore of a database is a normal job for developers and DBAs. This script will be helpfull to findout, from which path, and which backup file a database was restored.
18 Feb 2013 by S. M. Ahasan Habib
I will explain very simple way to execute multiple script files (*.sql) from a directory.
19 Feb 2013 by Rajesh Manjarekar
I found out that a possible cause is the difference between the SSIS 32 bits and 64 bits environment
29 Apr 2013 by ChienVH
This article will show you how to implement Asp.Net membership into a new database
15 May 2013 by Manikandan Sekar
Loading Data from Excel
5 Sep 2013 by Mubin M. Shaikh
Manually Run SSRS Scheduled Reports
29 Sep 2013 by Mubin M. Shaikh
Create Named Query in Data Source View While Designing OLAP Cube in SSAS
27 Jan 2017 by Rajesh_K_Sharma
How to create CSV file in SQL
31 Mar 2014 by h_wiedey
Usage of instead of triggers in Object-Relational (O/R) Mapping
25 Feb 2014 by Darek Danielewski
This article demonstrates how to safely dequeue items from a shared table
9 Jul 2014 by Jason Parms
Lightweight Directory Access Protocol (LDAP) Injection
29 Dec 2015 by Daniel Miller
This tip provides a simple solution to automate the generation of entity and mapping classes for Entity Framework.
28 Oct 2016 by Pavel Sinkevich
If data source is populated manually, there is a typical problem: a mix of visually similar Cyrillic and Latin letters. This tip describes how to fix it.
22 Sep 2017 by #realJSOP
It doesn't always happen the way you expect.
25 Nov 2017 by A.Ebrahimi
Connect to local database on MS SQL Server in local machine and develop node.js code
11 Jul 2018 by Satnam Singh CapGemini
Cannot Bulk Load Data Into the Table with Primary Key Constraint on it
8 Jan 2020 by E. Scott McFadden
This article explains how to create and use a self referencing key in a SQL Server Table.
2 Nov 2021 by Herman<T>.Instance
Migrations does not apply to T-SQL rules for ALTER TABLE ALTER COLUMN
26 Aug 2010 by tarun_j200
Also use either this one:SELECT OBJECT_NAME(SYSINDEXES.id), SYSINDEXES.rowcntFROM SYSINDEXES INNER JOIN SYSOBJECTS ON SYSINDEXES.id = SYSOBJECTS.idWHERE SYSINDEXES.indid
13 Nov 2010 by tarun_j200
SSMS also provides the option to generate SQL script file which contains both schema and data.Right click the database and select Generate Scripts under Tasks Menu.Click Set Scripting Options on the left hand menu (in SQL Server 2008 R2) then click Advanced button, there is an option under...
19 Feb 2015 by DrABELL
Generate large data series by using Cartesian Product and small data table
7 Jan 2011 by Member 3128846
Example to implement remoting concept using SQL Server database
23 Jan 2011 by sx2008
The root cause why the transaction log file grows so big is the wrong recovery model.The recovery model is set to full by default.99 percent of all SQL Servers never make use of this model because there is no backup of the transaction log file.So the great majority of all databases should...
22 Feb 2011 by Costica U
Here is another solution:IF OBJECT_ID( 'tempdb..#TestTable' ) IS NOT NULL BEGIN DROP TABLE #TestTable ENDCREATE TABLE #TestTable ( Column1 varchar(1), Column2 int )INSERT INTO #TestTable VALUES ('A', 1);INSERT INTO #TestTable VALUES ('A', 1); --...
16 Feb 2013 by 1Lam
Create the following table on a local database:CREATE TABLE [dbo].[TB_TEMP_TABLESTORE]( [SEARCH_STRING] [nvarchar](128) NULL, [DB_NAME] [nvarchar](128) NULL, [OBJECT_NAME] [nvarchar](128) NULL, [OBJECT_TYPE] [nvarchar](50) NULL) ON [PRIMARY]Rename Yourdatabase to the same...
26 May 2011 by #realJSOP
When all else fails, fire off some events and bask in the glow of the IDE's Progress tab.
7 Jun 2011 by Shahriar Iqbal Chowdhury/Galib
Hi,Here is an alternative for your solutionSELECT CAST(DATEADD(MILLISECOND,SUM(DATEDIFF(MILLISECOND,0,CAST(TMP.TotalTime as DATETIME))),0) as TIME)FROM( SELECT CAST(timeduration AS TIME) TotalTime FROM mytable) TMP
23 Jun 2011 by zvin
When comparing data stored in databases, you don't need to use RTRIM()
18 Jul 2011 by RaviRanjanKr
A tip enable you to learn how to use Column_Index instead of Column Name with Order by clause
17 Aug 2011 by bmckuhen
18 Oct 2011 by Kabwla.Phone
You also might want to look into the "LOCAL" keyword.This limits the scope of the cursor to the context in which it is created.DECLARE IdCursor CURSOR LOCAL FOR SELECT Id FROM MyTableThis is beneficial for many reasons.
25 Oct 2011 by Jaume Pascual
SELECT DISTINCT so.name FROM dbo.sysobjects so inner join .dbo.syscomments sc on so.id=sc.id WHERE so.xtype='P' AND sc.text like '%SearchString%'Much faster!
25 Jan 2012 by IkhwanKrisnadi
How to execute SQL Query / SQL Command on SQL Server using command prompt.