.

SQL commands Overview

Capturing Errors and Rowcount at once (only avail for one SQL command – therefore grab both at once)
SELECT * FROM customer
SELECT @RowCount = @@ROWCOUNT, @Error = @@ERROR

Declaring vars:
DECLARE @j varchar(10)

Casting:
CAST(@@ROWCOUNT AS varchar(12))

Temp tables:
CREATE TABLE #Temp (i int, j varchar(10))
INSERT INTO #Temp (i, j) VALUES (1, ‘First Row’)
INSERT INTO #Temp (i, j) VALUES (1, ‘Second Row’)
GO

 

other interresting examples:

select n as [Matched state], a as Episodes  , b as Isolates from
(
SELECT ‘Matched’ as n, 1024 as a, 1024 as b
union SELECT ‘Partially’ , 12 ,12
union SELECT’No Match’ as n , 33 as a ,27 as b
) as t

What's your thoughts on this?

*

Protected by WP Anti Spam