DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
 
 
SITE SEARCH SQLUSA.com VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
How to use generate binary sequences?

Execute the following Microsoft SQL Server T-SQL scripts in Management Studio Query Editor to create 8 bit ( 1 byte ) 256 combinations of 0-s and 1-s.

-- SQL bit column type - SQL binary data - SQL table variable

-- SQL cross join - Cartesian product for all combinations

USE AdventureWorks;

DECLARE  @Binary  TABLE(

                        Digit BIT

                        )

 

INSERT @Binary

VALUES(0) -- 0 is commonly interpreted as FALSE as logical operation result

 

INSERT @Binary

VALUES(1) -- 1 is commonly interpreted as TRUE as logical operation result

 

SELECT a.Digit  AS Bit7,

       b.Digit  AS Bit6,

       c.Digit  AS Bit5,

       d.Digit  AS Bit4,

       e.Digit  AS Bit3,

       f.Digit  AS Bit2,

       g.Digit  AS Bit1,

       h.Digit  AS Bit0

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

ORDER BY a.Digit,

       b.Digit,

       c.Digit,

       d.Digit,

       e.Digit,

       f.Digit,

       g.Digit,

       h.Digit

 

GO

 

/* Partial results

 

Bit7  Bit6  Bit5  Bit4  Bit3  Bit2  Bit1  Bit0

0     0     0     0     0     0     0     0

0     0     0     0     0     0     0     1

0     0     0     0     0     0     1     0

0     0     0     0     0     0     1     1

0     0     0     0     0     1     0     0

0     0     0     0     0     1     0     1

0     0     0     0     0     1     1     0

0     0     0     0     0     1     1     1

*/

Exam Prep 70-461
SQL 2016 DESIGN & PROGRAMMING
 
 
 
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE