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
Month: December 2011
if I want to rename ModifiedBy to LastModifiedBy ALTER TABLE dbo.Safety DROP COLUMN ModifiedBy ADD LastModifiedBy nvarchar(50)
alter table MyTable add constraint MyTable_MyColumn_FK FOREIGN KEY ( MyColumn ) references MyOtherTable(PKColumn)
declare @Find varchar(20) declare @search varchar(50) SET @Find=’- ‘ SET @Search=’hhhjoehhh-joehhhjoex- 02340’ SELECT COALESCE(RIGHT(@search, NullIf(CHARINDEX(REVERSE(@Find), REVERSE(@search)), 0)-1), @search)