Category: SQL Server
-
How to pass multiple records to stored procedure in Asp.net?
There are three main ways to pass multiple records to the stored procedure. To know what is a table-valued parameter and how to pass a data table to stored procedure and implement upsert (update + insert) logic using Merge Statement, check out an old post here. We’ll see in this post how you can pass […]
-
Tip: Schema qualify database objects
When working in a team, it may happen that few of the team mates follow best practices and others don’t give damn about it. They just completes the tasks on the name of ‘getting things done’. It may create nightmares if all the team members don’t follow the best practices. Either do it or don’t. […]
-
Specify size for character data type
Recently I was referring to books online to confirm one strange behavior in SQL Server. In one of the legacy applications, string was being passed to the stored procedure as parameter and it was storing only 30 characters. To my surprise when I saw the code, everything seemed OK. Later on I found out that […]
-
SQL Server Add-In : SSMS Tools Pack
SSMS Tools Pack, I downloaded this free Add-in 3 weeks ago, and I am glad that I did that. Below are the few features that I’ve been using so far : You can check out more useful features here and you can download it here. This add-in makes life easier with its number of features […]
-
Outer joins and search predicates – II
In my last post, we saw that if we place a search predicate in WHERE clause instead of placing it along with the ON clause, we may get the expected output. Now let’s understand what happens behind the scene. Note: we’ll use the pubs database for the example. Suppose we want to list all the […]
-
Outer joins and search predicates
We often use outer joins to construct queries and get the expected output, but what if you get an unexpected output and the query seems OK. A few days ago, I experienced the same thing and discovered the problem with the placement of the predicate (search condition). Let’s take an example : We’ll use the […]
-
Update with join and unexpected output
Recently one of my colleagues was writing a trigger, and in that, he’s having Update Query with join, syntax, and everything was right, but he’s not getting the expected output. To understand the situation, let’s take an example. Create two temporary tables: And Inset the following values in both tables. Now both the table contains […]
-
SQL Server 2008 : Table Valued Parameter and Merge
Recently I was working on one project, and I was supposed to Insert/Update many records in the database. I wanted to do it in a single round trip. I Googled it and found two excellent features of SQL Server 2008: the Table Valued Parameter and Merge Statement. Table Valued Parameter allows you to send many […]