http://msdn.microsoft.com/en-us/library/ms188730.aspx To create a partitioned table In Object Explorer, connect to an instance of Database Engine. On the Standard bar, click New Query. Copy and paste the following example into the query window and click Execute. The example creates new filegroups, a partition function, and…
Category: sql sever syntax
http://sqlity.net/en/2338/fix-orphaned-users/ /* ** Ctrl+Shift+M: replace parameters. ** */ SET NOCOUNT ON; SET QUOTED_IDENTIFIER OFF; GO USE <database_name,,>; GO DECLARE @sql varchar(100); DECLARE curSQL CURSOR FOR SELECT “EXEC sp_change_users_login ‘UPDATE_ONE’, ‘” + name + “‘, ‘” + name + “‘” FROM sysusers…
https://support.microsoft.com/en-us/help/918992/how-to-transfer-logins-and-passwords-between-instances-of-sql-server sp_hexadecimal USE [master] GO /****** Object: StoredProcedure [dbo].[sp_hexadecimal] Script Date: 10/14/2014 2:00:01 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[sp_hexadecimal] @binvalue varbinary(256), @hexvalue varchar (514) OUTPUT AS DECLARE @charvalue varchar (514) DECLARE @i int…
sp_who — gives less details sp_who2 ‘active’ kill 52
DECLARE @Number int; SET @Number = 50; IF @Number > 100 PRINT ‘The number is large.’; ELSE BEGIN IF @Number < 10 PRINT ‘The number is small.’; ELSE PRINT ‘The number is medium.’; END ; GO
if I want to rename ModifiedBy to LastModifiedBy ALTER TABLE dbo.Safety DROP COLUMN ModifiedBy ADD LastModifiedBy nvarchar(50)