Microsoft SQL Server 2005 Best Practices

How to generate binary sequences?

 

Execute the following script in Query Editor to create departmental abbreviations:

USE AdventureWorks;

DECLARE @Binary table ( Digit bit)

INSERT @Binary VALUES (0)
INSERT @Binary VALUES (1)

SELECT a.Digit, b.Digit, c.Digit, d.Digit,
e.Digit, f.Digit, g.Digit, h.Digit
FROM @Binary a
CROSS JOIN @Binary b
CROSS JOIN @Binary c
CROSS JOIN @Binary d
CROSS JOIN @Binary e
CROSS JOIN @Binary f
CROSS JOIN @Binary g
CROSS JOIN @Binary h


GO


 

The Best SQL Server 2005 Training in the World
 
 
SQLUSA.com Home Page