|
|
-
|
|
I have already blogged about the usage of BULK INSERT in this post
http://beyondrelational.com/blogs/madhivanan/archive/2010/03/17/bulk-insert-to-table-with-specific-columns.aspx
You can use BULK INSERT command to import data from a file to a table. However if the field seperator is a comma and ......
|
|
-
|
|
OPENROWSET function can be used to query on the database exists in different server or query on the stored procedure. Consider that the system procedure sp_who2 gives informations about the current users, sessions, etc.
EXEC sp_who2
But note that the resultset has two columns with the same name......
|
|
-
|
|
I have already posted a blogpost on how to query directly on a EXCEL file using a query. Here is the link http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/import-export-to-excel.aspx But for EXCEL, verions starting from 2007, different Provider should be used. Here is the provider whi......
|
|
-
|
|
I have already posted blog posts regarding the proper usage of the alias name
http://beyondrelational.com/blogs/madhivanan/archive/2007/11/14/should-alias-names-be-preceded-by-as.aspx http://beyondrelational.com/blogs/madhivanan/archive/2008/09/09/should-alias-names-be-preceded-by-as-part-2.aspx T......
|
|
-
|
|
Suppose you have a set of codes and when a particular condition is true, you want to terminate or switch to another set of code, you can use Break commnad. I see sometimes people use return commnad for this. But there is a significant difference between these two. Consider this example
Usage of BR......
|
|
-
|
|
We frequently use some datatypes like INT, CHAR, VARCHAR,etc. But there are currently 37 datatype supported by SQL Server. If you want to know the list of supported datatype, run the following methods
Method 1 : Use system stored procedure sp_datatype_info
exec sp_datatype_info
Method 2 : Us......
|
|
-
|
|
You know that Create or alter procedure statement should be always in a seperate batch otherwise you will get an error "'CREATE/ALTER PROCEDURE' must be the first statement in a query batch." Sometime when you want to create or alter the procedure based on the existance of a procedure you may wonder......
|
|
-
|
|
If you want to count the number that exceeds the maximum value of INT datatype, you can make use of COUNT_BIG function. COUNT_BIG function always returns a bingint datatype value. Consider the following example code which uses both COUNT_BIG and COUNT function
select COUNT_BIG(*) as big_number, COU......
|
|
-
|
|
In this blog post, I have already blogged about knowing version of the server using different methods. One other method is to make use of @@MicrosoftVersion frunction
select @@MicrosoftVersion,CAST(@@MicrosoftVersion as binary(5))
The result is
------------ ------------
167773760 0x000A00......
|
|
-
|
|
Quotename() function is used to return a unicode string with delimiters. A delimiter can be a single quote, double quote or braces ( or [.
select
quotename('test','''') as single_quote,
quotename('test','"') as double_quote,
quotename('test','(') as brace,
quotename('test','[') as sqaure......
|
|