T-SQL Example code: SQL Fixes

Here are a few lines of code that have got me out of troubel in the past:

Reset an Ident Column counter value

use TSinfo
go
DBCC CHECKIDENT ('DNS',RESEED,1)

Allow network access

By default remote connections are disabled, to enable them you need to run the SQL Server Surface Area Configuration from the start menu, then restart the SQL service.

Rem a line out

use – to rem out a line in a query (two minus signs)

Resolve database diagram problem

EXEC sp_dbcmptlevel 'libraryDB', '90';

go

ALTER AUTHORIZATION ON DATABASE::libraryDB TO "simon"

go

use [librarydb]

go

EXECUTE AS USER = N'dbo' REVERT

go

Posted on July 12, 2012 at 23:29 by simon · Permalink
In: SQL · Tagged with: , ,

Leave a Reply