Category Archives: SQL Server

How to add multiple rows to a table at once

Let’s face it, most of the apps in the galaxy we live in are data bound. I don’t write apps that use sockets and presumably most of you don’t either, correct? Now, in our day to day lives, we generally … Continue reading

Posted in SQL Server | Leave a comment

How to Call a UDF using ADO.NET

Let’s face it, most of us typically work with Stored Procedures with modest complexity using JOINS and such. Some of us embed Common Table Expressions (CTE) in the stored procs. If you are already using Entity Framework 2.2, you would … Continue reading

Posted in .NET, ADO.NET, SQL Server | Leave a comment

Import CSV into SQL Server using VBA

You have heard the famous clichΓ©, “there are many ways to skin a cat”. That said, there are many ways to import a flat file into SQL Server. Some of them include the following: SSMS – Select Database -> Right … Continue reading

Posted in SQL Server | Leave a comment

How to combine multiple stored procedures into a single resulset

Let’s say, you have multiple stored procedures each of which is tied to a partial view or View Component in MVC. Now, while this may seem like a logical thing to do, but what if you want the entire payload … Continue reading

Posted in SQL Server | Comments Off on How to combine multiple stored procedures into a single resulset

How to pass delimited list to a Stored Procedure

Let’s write a Table-valued function below. This can be created by navigating to Functions – Table-Valued Functions inside SQL Management Studio. Just an FYI, I am using the AdventureWorks database, but thisΒ  sample can be used in any situation. CREATE … Continue reading

Posted in SQL Server | Comments Off on How to pass delimited list to a Stored Procedure

Difference between Varchar and Nvarchar. When to use what?

This post was replaced by an erroneous content by an intruder…I will have re-write it. The inconvenience is regretted my dear lovely readers!

Posted in SQL Server | Leave a comment

What is the difference between Delete and Truncate

To order essay on an author of the essay not only that but safely. Our exchange provides a number of obligations, which guarantee customers that they will receive a high quality and decent work: each essay is checked by the … Continue reading

Posted in SQL Server | Comments Off on What is the difference between Delete and Truncate

What are Nested Transactions in SQL Server?

As the name suggests, nested transaction is one that is nested within a transaction. Let’s illustrate this with an example. Let’s create a table: CREATE TABLE PERSON ( ID INT IDENTITY(1,1), FirstName VARCHAR(25), LastName VARCHAR(25), Gender CHAR(1) ) SELECT * … Continue reading

Posted in SQL Server | Comments Off on What are Nested Transactions in SQL Server?

How to partition the result set in SQL Server

To query the first row or the last row in a table is easy-piecey.Β  You simply select the Top 1 row and order the query by ascending or descending. But, how about selecting the second, third or tenth row from … Continue reading

Posted in SQL Server | Comments Off on How to partition the result set in SQL Server