SQL Server

Home / SQL Server

Delete all rows from all tables in a SQL Server database

I have seen most of the time Developer asked me this question .. Following below is solutio   Set nocount on Exec sp_MSForEachTable ‘Alter Table ? NoCheck Constraint All’ Exec

Delete Duplicate row in SQL Server

Following below query help you to delete duplicate row in sql sever DELETE A FROM table1 A where %%physloc%% > ( SELECT min(%%physloc%%) FROM table1 B WHERE A.ID= B.ID) In

How do you check what version of SQL Server for a database using TSQL?


Get All Databases Size in SQL Server

SELECT d.name, ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs FROM sys.master_files mf INNER JOIN sys.databases d ON d.database_id = mf.database_id WHERE d.database_id > 4 — Skip system databases GROUP BY

Get all the database names in a sql server instance using tsql

its a simple sql : SELECT * FROM sys.databases ;

Tables without a clustered index are not supported in this version of SQL Server

when you published the MVC application for windows AZURE cloud and SQL Azure it’s giving below mentioned error. Tables without a clustered index are not supported in this version of

How to enable remote connections in SQL Server 2008?

You experience the following error message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that

Drop all the tables, stored procedures, triggers, constriants and all the dependencies in one sql statement

Lot many times people asking me how to delete or drop all object like SP, Table and views of any table. For them i have written following solution. /* Drop

SQL Server Message: Prevent saving changes that require the table re-creation

I have seen and faces following issue most of the time .. when you are going to alter the table .. Saving Changes in not permitted. The changes you have

Reset AutoIncrement in SqlServer after Delete

Hi, This is most common issue face everybody in day to day life, to resolve this use following command to reseed mytable to start at 1:  DBCC CHECKIDENT (mytable, RESEED,1)