1-- Example Transact-SQL file. 2 3-- Single line comment 4/* A comment 5 * spawning two lines. */ 6 /* An indented comment 7 * spawning multiple 8 * lines. */ 9/* A /* nested */ comment. */ 10 11select 12 left(emp.firstname, 1) + '.' + [emp.surname] as "Name", 13 dep.name as [Department] 14into 15 #temp_employee 16from 17 employee as emp 18 inner join department as dep on 19 dep.ident_code = emp.department_id 20where 21 emp.date_of_birth >= '1990-01-01'; 22go 23 24declare @TextToFind nvarchar(100) = N'some 25text across 26multiple lines'; 27 28set @TextToFind varchar(32) = 'hello' + ' world'; 29set @TextTiFind += '!'; 30 31declare @Count int = 17 * (3 - 5); 32 33delete from 34 [server].[database].[schema].[table] 35where 36 [Text] = @TextToFind and author Not LIKE '%some%'; 37 38goto overthere; 39overthere: 40 41select 42 123 as "int 1", 43 +123 as "int 2", 44 -123 as "int 3", 45 0x20 as "hex int", 46 123.45 as "float 1", 47 -1.23e45 as "float 2" 48 +1.23E+45 as "float 3", 49 -1.23e-45 as "float 4", 50 1. as "float 5", 51 .1 as "float 6", 52 1.e2 as "float 7", 53 .1e2 as "float 8"; 54 55Select @@Error, $PARTITion.RangePF1(10); 56 57select top 3 Ähnliches from Müll; 58 59-- Example transaction 60BEGIN TRAN 61 62BEGIN TRY 63 INSERT INTO #temp_employe(Name, Department) VALUES ('L. Miller', 'Sales') 64 iNsErT inTO #temp_employe(Name, Department) VaLuEs ('M. Webster', 'Helpdesk') 65 COMMIT TRAN 66END TRY 67BEGIN CATCH 68 print 'cannot perform transaction; rolling back'; 69 ROLLBACK TRAN 70END CATCH 71 72-- Comment at end without newline.