sql server2005
Save your SELECT query results in XML File or Text File.
To save the result of your SELECT query to XML or a text file. Well use xp_cmdshell. xp_cmdshell is an extended stored procedure kept in the master database. It issues OS commands directly to the Windows command shell. You need to be a member of the sys_admin...
Compare data between two tables in SQL Server 2005
Inorder to find the difference of two tables in schema and data betweeen Source and distination tables. we can use Tablediff in SQL Server 2005 You can run this utility from the command line or a batch file. Ex: if you have two Databases one for Production...
How to encrypt a stored procedure in SQL Server 2005
Inorder to encrypt the text of stored procedures containing sensitive information, Sql Server provides WITH ENCRYPTION to encrypt the Stored Procedure. CREATE procedure [dbo].[SP_GET_Employee_Details_encrypt] WITH ENCRYPTION AS SELECT EMP_id,First_name,Last_name,Email_id...
How to check the active connections for each Database in SQL Server 2005
We need to check the number of active connections for a Database on our server. We can get that details by using the following SQL script. This SQL script displays the DatabaseName, the number of connections and the login name : SELECT db_name(dbid) as...
Display Last Modified Stored Procedure using SQL Server 2005/2008
To get a list of the Stored Procedure that were last modified, use this query SELECT TOP 10 modify_date,name FROM sys.procedures ORDER BY modify_date DESC --
Article on Sqlserver Indexes
One of the most powerful way to get high performance in a SQL Server database is the index. Indexes speed up the your querying process by providing swift access to rows in the data tables, like the way a book’s index helps you find information quickly...
Custom Paging in SQLServer2005 and Dotnet Application
Custom Paging in SQLServer2005 and Dotnet Application Subsets via SQL Server 2005 There are various techniques for handling this issue, but SQL Server 2005 introduced a new feature that changed everything. SQL Server 2005 simplifies retrieving subsets...
Datetime Formates and Date time manipulations in SQL Server
Different Datetime formates in sqlserver print getdate() -- May 19 2009 3:21AM print convert(varchar(max),getdate(),101) -- 05/19/2009 print convert(varchar(max),getdate(),102) -- 2009.05.19 print convert(varchar(max),getdate(),103) -- 19/05/2009 print...
Case Statement Tricks
The CASE statement is a very flexible tool. Here are just a few of the tricks you can work with it. Item translation One of the simplest things you can do is to derive a columns contents based on it’s contents, or the contents of another data item. SELECT...
Concatenating Row Values in Transact-SQL
Concatenating Row Values in Transact-SQL There are a number of solutions and considerable debate. How do you go about Concatenating Row values. By 'Concatenating row values' we mean this: You have a table, view or result that looks like below......and...