-
SQL SERVER – Database in RESTORING State for Long Time
Today, I would like to share this with others after I did. Non recovery sate to recover the database. That…
-
Check if database exists?
USE YourDatabaseName GO SET @dbname = ‘YourDatabaseName’ IF NOT EXISTS(SELECT*FROMsys.databasesWHERE name = @dbname ) BEGIN –Do Something here…
-
How to remove a column from an existing table?
This example is simple. Let’s remove the created column in existing table. 1.Just add a new column to an existing…
-
SQL Server – How to Find Tables with Foreign Key Constraint in Database
This article is a finding foreign key in tables. Hope that you may not waste your time with finding in…
-
SQL Server – Stored Procedure and Transactions
This is a demonstration of Transactions and roll back in a stored procedure. Let’s create a table and try it.…
-
Use of ROW_NUMBER(),RANK() and Partition by clause in SQL Server 2005,2008,2008R2 and 2012
Let’s create a table for demonstration and insert some records into the table. –Create a test table CREATE TABLE Tbl_Partition_Test…
-
SQL Server Cursor – Simple script to backup all SQL Server databases
This is an example cursor from tip Simple script to backup all SQL Server databases (mssqltips.com) where backups are issued…
-
Installing ASP.NET Membership services database in SQL Server 2008 R2
Create a new database with file group or as usual. Note that the below script is using file group as an…
-
SQL Server 2008 R2 – Cannot Connect to Server
I just post this article for someone who is facing following issue. it can be easily resolved with following steps. 1) Please go…
-
SQL Ordinal Number function
I wiold like to share with you about follwon Ordinal Number function script which include an integer input parameter. SET ANSI_NULLS ON…