הבלוג של גרי רשף

05/03/2010

כיצד אין פותרים בעיות סודוקו

Filed under: Uncategorized — תגיות: , — גרי רשף @ 15:44

יש DBA-ים שכל כך עסוקים לשחק Solitaire במחשב, עד שלא נותר להם זמן לדברים חשובים באמת כמו לפתור את הסודוקו בעתון..
בשביל זה אנחנו כאן וננסה למצוא דרך לעשות זאת בעזרת SQL, ולהוריד כך מעט מהעומס המוטל על אנשי המקצוע!

נתחיל בדרך מעט נאיבית- ניתן למחשב לבדוק את כל האפשרויות: שיעבוד קשה בשעה שאנחנו עסוקים בדברים אחרים.
השיטה באופן כללי תהיה כך:
1. ניצור טבלת עזר ובה !9 האפשרויות לכתוב את המספרים 1..9.
2. נעשה Join של טבלה זו עם עצמה 27 פעמים (9 שורות + 9 עמודות + 9 ריבועים שיש בכל בעיית סודוקו).
3. נוסיף תנאי Where כך שישלפו מטבלת העזר רק שורות שמתאימות לבעייה הספציפית.
4. את התוצאה נכניס לטבלת פתרונות בה יש 81 עמודות כנגד 81 המשבצות בלוח הסודוקו, ונציג אותה באופן קריא.
אפשר כמובן לעשות זאת אחרת, אבל זו "הצעת הגשה" מטעמי.

יצירת טבלת עזר:
לשליפה של המספרים 1..9 נבצע Join עצמי 9 פעמים,
נתנה בכך שכל המספרים שונים זה לזה,
ואת !9 הרשומות שנקבל נכניס לטבלה T_Sudoku:

Create Table T_Sudoku(N1 Int,N2 Int,N3 Int,N4 Int,N5 Int,N6 Int,N7 Int,N8 Int,N9 Int);

Go

Create Unique Clustered Index T_Sudoku_Idx On T_Sudoku(N1,N2,N3,N4,N5,N6,N7,N8,N9);

Go

With T As

(Select 1 Mispar

Union All

Select Mispar+1

From T

Where Mispar<9)

Insert Into T_Sudoku

Select    *

From    T T1,

        T T2,

        T T3,

        T T4,

        T T5,

        T T6,

        T T7,

        T T8,

        T T9

Where    T2.Mispar Not In (T1.Mispar)

        And T3.Mispar Not In (T1.Mispar,T2.Mispar)

        And T4.Mispar Not In (T1.Mispar,T2.Mispar,T3.Mispar)

        And T5.Mispar Not In (T1.Mispar,T2.Mispar,T3.Mispar,T4.Mispar)

        And T6.Mispar Not In (T1.Mispar,T2.Mispar,T3.Mispar,T4.Mispar,T5.Mispar)

        And T7.Mispar Not In (T1.Mispar,T2.Mispar,T3.Mispar,T4.Mispar,T5.Mispar,T6.Mispar)

        And T8.Mispar Not In (T1.Mispar,T2.Mispar,T3.Mispar,T4.Mispar,T5.Mispar,T6.Mispar,T7.Mispar)

        And T9.Mispar Not In (T1.Mispar,T2.Mispar,T3.Mispar,T4.Mispar,T5.Mispar,T6.Mispar,T7.Mispar,T8.Mispar);

Go

ה-CTE (ששמו T) יוצר את המספרים 1..9, בהמשך הוא מוכפלים קארטזית זה עם זה, ובתנאי Where מוודאים שכל אחד שונה מאלו שלפניו.

כעת ניצור טבלה עבור פתרון הבעייה: 81 עמודות כנגד 81 משבצות הסודוקו, ועמודת מונה (לכל בעייה ישמר פתרון בשורה אחת והמונה יציין באיזו בעייה מדובר):

Create Table T_Pitron(Mone Int,

            N01_1 Int,N01_2 Int,N01_3 Int,N01_4 Int,N01_5 Int,N01_6 Int,N01_7 Int,N01_8 Int,N01_9 Int,

            N02_1 Int,N02_2 Int,N02_3 Int,N02_4 Int,N02_5 Int,N02_6 Int,N02_7 Int,N02_8 Int,N02_9 Int,

            N03_1 Int,N03_2 Int,N03_3 Int,N03_4 Int,N03_5 Int,N03_6 Int,N03_7 Int,N03_8 Int,N03_9 Int,

            N04_1 Int,N04_2 Int,N04_3 Int,N04_4 Int,N04_5 Int,N04_6 Int,N04_7 Int,N04_8 Int,N04_9 Int,

            N05_1 Int,N05_2 Int,N05_3 Int,N05_4 Int,N05_5 Int,N05_6 Int,N05_7 Int,N05_8 Int,N05_9 Int,

            N06_1 Int,N06_2 Int,N06_3 Int,N06_4 Int,N06_5 Int,N06_6 Int,N06_7 Int,N06_8 Int,N06_9 Int,

            N07_1 Int,N07_2 Int,N07_3 Int,N07_4 Int,N07_5 Int,N07_6 Int,N07_7 Int,N07_8 Int,N07_9 Int,

            N08_1 Int,N08_2 Int,N08_3 Int,N08_4 Int,N08_5 Int,N08_6 Int,N08_7 Int,N08_8 Int,N08_9 Int,

            N09_1 Int,N09_2 Int,N09_3 Int,N09_4 Int,N09_5 Int,N09_6 Int,N09_7 Int,N09_8 Int,N09_9 Int);

Go

Create Unique Clustered Index T_Pitron_Idx On T_Pitron(Mone);

Go

כעת נמצא בעייה מתאימה: ניגשתי לאתר www.Sudoku.co.il (אין לי מניות שם- מגיע להם קרדיט!) ושלפתי משם את הבעייה הראשונה שמצאתי:

 Sudoku

וכעת לשליפה (קצת ארוך – נראה כמה נמוך אתם יכולים לרדת עם פס הגלילה האנכי):

Insert Into T_Pitron(Mone,

            N01_1 ,N01_2 ,N01_3 ,N01_4 ,N01_5 ,N01_6 ,N01_7 ,N01_8 ,N01_9 ,

            N02_1 ,N02_2 ,N02_3 ,N02_4 ,N02_5 ,N02_6 ,N02_7 ,N02_8 ,N02_9 ,

            N03_1 ,N03_2 ,N03_3 ,N03_4 ,N03_5 ,N03_6 ,N03_7 ,N03_8 ,N03_9 ,

            N04_1 ,N04_2 ,N04_3 ,N04_4 ,N04_5 ,N04_6 ,N04_7 ,N04_8 ,N04_9 ,

            N05_1 ,N05_2 ,N05_3 ,N05_4 ,N05_5 ,N05_6 ,N05_7 ,N05_8 ,N05_9 ,

            N06_1 ,N06_2 ,N06_3 ,N06_4 ,N06_5 ,N06_6 ,N06_7 ,N06_8 ,N06_9 ,

            N07_1 ,N07_2 ,N07_3 ,N07_4 ,N07_5 ,N07_6 ,N07_7 ,N07_8 ,N07_9 ,

            N08_1 ,N08_2 ,N08_3 ,N08_4 ,N08_5 ,N08_6 ,N08_7 ,N08_8 ,N08_9 ,

            N09_1 ,N09_2 ,N09_3 ,N09_4 ,N09_5 ,N09_6 ,N09_7 ,N09_8 ,N09_9 )

Select    1 Mone,

        T01.N1 N01_1,

        T01.N2 N01_2,

        T01.N3 N01_3,

        T01.N4 N01_4,

        T01.N5 N01_5,

        T01.N6 N01_6,

        T01.N7 N01_7,

        T01.N8 N01_8,

        T01.N9 N01_9,

 

        T02.N1 N02_1,

        T02.N2 N02_2,

        T02.N3 N02_3,

        T02.N4 N02_4,

        T02.N5 N02_5,

        T02.N6 N02_6,

        T02.N7 N02_7,

        T02.N8 N02_8,

        T02.N9 N02_9,

 

        T03.N1 N03_1,

        T03.N2 N03_2,

        T03.N3 N03_3,

        T03.N4 N03_4,

        T03.N5 N03_5,

        T03.N6 N03_6,

        T03.N7 N03_7,

        T03.N8 N03_8,

        T03.N9 N03_9,

 

        T04.N1 N04_1,

        T04.N2 N04_2,

        T04.N3 N04_3,

        T04.N4 N04_4,

        T04.N5 N04_5,

        T04.N6 N04_6,

        T04.N7 N04_7,

        T04.N8 N04_8,

        T04.N9 N04_9,

 

        T05.N1 N05_1,

        T05.N2 N05_2,

        T05.N3 N05_3,

        T05.N4 N05_4,

        T05.N5 N05_5,

        T05.N6 N05_6,

        T05.N7 N05_7,

        T05.N8 N05_8,

        T05.N9 N05_9,

 

        T06.N1 N06_1,

        T06.N2 N06_2,

        T06.N3 N06_3,

        T06.N4 N06_4,

        T06.N5 N06_5,

        T06.N6 N06_6,

        T06.N7 N06_7,

        T06.N8 N06_8,

        T06.N9 N06_9,

 

        T07.N1 N07_1,

        T07.N2 N07_2,

        T07.N3 N07_3,

        T07.N4 N07_4,

        T07.N5 N07_5,

        T07.N6 N07_6,

        T07.N7 N07_7,

        T07.N8 N07_8,

        T07.N9 N07_9,

 

        T08.N1 N08_1,

        T08.N2 N08_2,

        T08.N3 N08_3,

        T08.N4 N08_4,

        T08.N5 N08_5,

        T08.N6 N08_6,

        T08.N7 N08_7,

        T08.N8 N08_8,

        T08.N9 N08_9,

 

        T09.N1 N09_1,

        T09.N2 N09_2,

        T09.N3 N09_3,

        T09.N4 N09_4,

        T09.N5 N09_5,

        T09.N6 N09_6,

        T09.N7 N09_7,

        T09.N8 N09_8,

        T09.N9 N09_9

 

From    (Select * From T_Sudoku Where 0=0 And N4=3 And N5=6 And N9=1) T01,

        (Select * From T_Sudoku Where 0=0 And N1=8 And N2=4 And N3=6 And N4=5 And N9=2) T02,

        (Select * From T_Sudoku Where 0=0 And N1=9 And N6=2 And N7=6 And N8=5) T03,

        (Select * From T_Sudoku Where 0=0 And N4=2 And N5=8 And N6=1 And N7=3 And N9=7) T04,

        (Select * From T_Sudoku Where 0=0 And N1=2 And N2=1 And N8=4 And N9=5) T05,

        (Select * From T_Sudoku Where 0=0 And N1=7 And N3=9 And N5=3) T06,

        (Select * From T_Sudoku Where 0=0 And N2=2 And N3=8 And N4=7 And N9=9) T07,

        (Select * From T_Sudoku Where 0=0 And N1=4 And N6=3 And N7=5 And N8=6 And N9=8) T08,

        (Select * From T_Sudoku Where 0=0 And N1=1 And N5=4 And N6=8) T09,

 

        (Select * From T_Sudoku Where 0=0 And N2=8 And N3=9 And N5=2 And N6=7 And N8=4 And N9=1) T11,

        (Select * From T_Sudoku Where 0=0 And N2=4 And N5=1 And N7=2) T12,

        (Select * From T_Sudoku Where 0=0 And N2=6 And N6=9 And N7=8) T13,

        (Select * From T_Sudoku Where 0=0 And N1=3 And N2=5 And N4=2 And N7=7) T14,

        (Select * From T_Sudoku Where 0=0 And N1=6 And N4=8 And N6=3 And N9=4) T15,

        (Select * From T_Sudoku Where 0=0 And N3=2 And N4=1 And N8=3 And N9=8) T16,

        (Select * From T_Sudoku Where 0=0 And N3=6 And N4=3 And N8=5) T17,

        (Select * From T_Sudoku Where 0=0 And N3=5 And N5=4 And N8=6) T18,

        (Select * From T_Sudoku Where 0=0 And N1=1 And N2=2 And N4=7 And N5=5 And N7=9 And N8=8) T19,

 

        (Select * From T_Sudoku Where 0=0 And N2=8 And N3=9 And N5=4 And N8=6) T21,

        (Select * From T_Sudoku Where 0=0 And N2=2 And N3=7 And N5=1 And N9=9) T22,

        (Select * From T_Sudoku Where 0=0 And N2=4 And N3=1 And N4=2 And N7=8) T23,

        (Select * From T_Sudoku Where 0=0 And N1=3 And N2=5 And N4=6 And N9=2) T24,

        (Select * From T_Sudoku Where 0=0 And N1=2 And N4=8 And N6=3 And N7=1) T25,

        (Select * From T_Sudoku Where 0=0 And N1=7 And N6=4 And N8=3 And N9=8) T26,

        (Select * From T_Sudoku Where 0=0 And N3=6 And N6=5 And N7=1 And N8=2) T27,

        (Select * From T_Sudoku Where 0=0 And N1=3 And N5=4 And N7=7 And N8=5) T28,

        (Select * From T_Sudoku Where 0=0 And N2=5 And N5=6 And N7=9 And N8=8) T29

 

Where        T01.N1=T11.N1 And T01.N1=T21.N1

        And T01.N2=T12.N1 And T01.N2=T21.N4

        And T01.N3=T13.N1 And T01.N3=T21.N7

        And T01.N4=T14.N1 And T01.N4=T24.N1

        And T01.N5=T15.N1 And T01.N5=T24.N4

        And T01.N6=T16.N1 And T01.N6=T24.N7

        And T01.N7=T17.N1 And T01.N7=T27.N1

        And T01.N8=T18.N1 And T01.N8=T27.N4

        And T01.N9=T19.N1 And T01.N9=T27.N7

 

        And T02.N1=T11.N2 And T02.N1=T21.N2

        And T02.N2=T12.N2 And T02.N2=T21.N5

        And T02.N3=T13.N2 And T02.N3=T21.N8

        And T02.N4=T14.N2 And T02.N4=T24.N2

        And T02.N5=T15.N2 And T02.N5=T24.N5

        And T02.N6=T16.N2 And T02.N6=T24.N8

        And T02.N7=T17.N2 And T02.N7=T27.N2

        And T02.N8=T18.N2 And T02.N8=T27.N5

        And T02.N9=T19.N2 And T02.N9=T27.N8

 

        And T03.N1=T11.N3 And T03.N1=T21.N3

        And T03.N2=T12.N3 And T03.N2=T21.N6

        And T03.N3=T13.N3 And T03.N3=T21.N9

        And T03.N4=T14.N3 And T03.N4=T24.N3

        And T03.N5=T15.N3 And T03.N5=T24.N6

        And T03.N6=T16.N3 And T03.N6=T24.N9

        And T03.N7=T17.N3 And T03.N7=T27.N3

        And T03.N8=T18.N3 And T03.N8=T27.N6

        And T03.N9=T19.N3 And T03.N9=T27.N9

 

        And T04.N1=T11.N4 And T04.N1=T22.N1

        And T04.N2=T12.N4 And T04.N2=T22.N4

        And T04.N3=T13.N4 And T04.N3=T22.N7

        And T04.N4=T14.N4 And T04.N4=T25.N1

        And T04.N5=T15.N4 And T04.N5=T25.N4

        And T04.N6=T16.N4 And T04.N6=T25.N7

        And T04.N7=T17.N4 And T04.N7=T28.N1

        And T04.N8=T18.N4 And T04.N8=T28.N4

        And T04.N9=T19.N4 And T04.N9=T28.N7

 

        And T05.N1=T11.N5 And T05.N1=T22.N2

        And T05.N2=T12.N5 And T05.N2=T22.N5

        And T05.N3=T13.N5 And T05.N3=T22.N8

        And T05.N4=T14.N5 And T05.N4=T25.N2

        And T05.N5=T15.N5 And T05.N5=T25.N5

        And T05.N6=T16.N5 And T05.N6=T25.N8

        And T05.N7=T17.N5 And T05.N7=T28.N2

        And T05.N8=T18.N5 And T05.N8=T28.N5

        And T05.N9=T19.N5 And T05.N9=T28.N8

 

        And T06.N1=T11.N6 And T06.N1=T22.N3

        And T06.N2=T12.N6 And T06.N2=T22.N6

        And T06.N3=T13.N6 And T06.N3=T22.N9

        And T06.N4=T14.N6 And T06.N4=T25.N3

        And T06.N5=T15.N6 And T06.N5=T25.N6

        And T06.N6=T16.N6 And T06.N6=T25.N9

        And T06.N7=T17.N6 And T06.N7=T28.N3

        And T06.N8=T18.N6 And T06.N8=T28.N6

        And T06.N9=T19.N6 And T06.N9=T28.N9

 

        And T07.N1=T11.N7 And T07.N1=T23.N1

        And T07.N2=T12.N7 And T07.N2=T23.N4

        And T07.N3=T13.N7 And T07.N3=T23.N7

        And T07.N4=T14.N7 And T07.N4=T26.N1

        And T07.N5=T15.N7 And T07.N5=T26.N4

        And T07.N6=T16.N7 And T07.N6=T26.N7

        And T07.N7=T17.N7 And T07.N7=T29.N1

        And T07.N8=T18.N7 And T07.N8=T29.N4

        And T07.N9=T19.N7 And T07.N9=T29.N7

 

        And T08.N1=T11.N8 And T08.N1=T23.N2

        And T08.N2=T12.N8 And T08.N2=T23.N5

        And T08.N3=T13.N8 And T08.N3=T23.N8

        And T08.N4=T14.N8 And T08.N4=T26.N2

        And T08.N5=T15.N8 And T08.N5=T26.N5

        And T08.N6=T16.N8 And T08.N6=T26.N8

        And T08.N7=T17.N8 And T08.N7=T29.N2

        And T08.N8=T18.N8 And T08.N8=T29.N5

        And T08.N9=T19.N8 And T08.N9=T29.N8

 

        And T09.N1=T11.N9 And T09.N1=T23.N3

        And T09.N2=T12.N9 And T09.N2=T23.N6

        And T09.N3=T13.N9 And T09.N3=T23.N9

        And T09.N4=T14.N9 And T09.N4=T26.N3

        And T09.N5=T15.N9 And T09.N5=T26.N6

        And T09.N6=T16.N9 And T09.N6=T26.N9

        And T09.N7=T17.N9 And T09.N7=T29.N3

        And T09.N8=T18.N9 And T09.N8=T29.N6

        And T09.N9=T19.N9 And T09.N9=T29.N9;

הסבר קצר כדי לא ללכת לאיבוד לפי האופרטורים שקל לזהות בצד שמאל:

Insert – טבלת היעד ו-81 משבצות הסודוקו שיקבלו ערכים.

Select – המונה של בעייה זו הוא 1, ו-81 משבצות הסודוקו שישלפו (שלפתי את 9 העמודות שאמורות להיות מתואמות עם השורות והריבועים).

From – מופיעות 27 שליפות משנה עם תנאי Where: בהתחלה 9 העמודות, אחר כך 9 השורות, ולבסוף 9 הריבועים.

Where – כל עמודה בת 9 משבצות מצטלבת 9 פעמים עם השורות ו-9 פעמים עם הריבועים.

הפעלתי, ולאחר כשעה וחצי קיבלתי סופסוף את הפתרון, שלנוחות המשתמש יוצג ב-9 שורות:

Select    N01_1,N02_1,N03_1,N04_1,N05_1,N06_1,N07_1,N08_1,N09_1 From T_Pitron Where Mone=1

Union All

Select    N01_2,N02_2,N03_2,N04_2,N05_2,N06_2,N07_2,N08_2,N09_2 From T_Pitron Where Mone=1

Union All        

Select    N01_3,N02_3,N03_3,N04_3,N05_3,N06_3,N07_3,N08_3,N09_3 From T_Pitron Where Mone=1

Union All        

Select    N01_4,N02_4,N03_4,N04_4,N05_4,N06_4,N07_4,N08_4,N09_4 From T_Pitron Where Mone=1

Union All        

Select    N01_5,N02_5,N03_5,N04_5,N05_5,N06_5,N07_5,N08_5,N09_5 From T_Pitron Where Mone=1

Union All        

Select    N01_6,N02_6,N03_6,N04_6,N05_6,N06_6,N07_6,N08_6,N09_6 From T_Pitron Where Mone=1

Union All        

Select    N01_7,N02_7,N03_7,N04_7,N05_7,N06_7,N07_7,N08_7,N09_7 From T_Pitron Where Mone=1

Union All        

Select    N01_8,N02_8,N03_8,N04_8,N05_8,N06_8,N07_8,N08_8,N09_8 From T_Pitron Where Mone=1

Union All        

Select    N01_9,N02_9,N03_9,N04_9,N05_9,N06_9,N07_9,N08_9,N09_9 From T_Pitron Where Mone=1

Go

האם עבור כל בעייה נצטרך להסתבך ולכתוב את שליפות המשנה שב-From מחדש (שאר חלקי ה-SQL לא ישתנו)?

לנוחות קהל המאזינים כתבתי פרוצדורה שבונה באופן דינאמי את ה-SQL הנ"ל, מריצה אותו ושולפת את הפתרון,

אך קודם לכן יש לבנות טבלת נתונים בה כל בעייה תוצג בשורה חדשה בדומה לפתרון:

Create Table T_Netunim(Mone Int Identity(1,1), Pratim VarChar(Max),Taarih DateTime Default GetDate(),

            N01_1 Int,N01_2 Int,N01_3 Int,N01_4 Int,N01_5 Int,N01_6 Int,N01_7 Int,N01_8 Int,N01_9 Int,

            N02_1 Int,N02_2 Int,N02_3 Int,N02_4 Int,N02_5 Int,N02_6 Int,N02_7 Int,N02_8 Int,N02_9 Int,

            N03_1 Int,N03_2 Int,N03_3 Int,N03_4 Int,N03_5 Int,N03_6 Int,N03_7 Int,N03_8 Int,N03_9 Int,

            N04_1 Int,N04_2 Int,N04_3 Int,N04_4 Int,N04_5 Int,N04_6 Int,N04_7 Int,N04_8 Int,N04_9 Int,

            N05_1 Int,N05_2 Int,N05_3 Int,N05_4 Int,N05_5 Int,N05_6 Int,N05_7 Int,N05_8 Int,N05_9 Int,

            N06_1 Int,N06_2 Int,N06_3 Int,N06_4 Int,N06_5 Int,N06_6 Int,N06_7 Int,N06_8 Int,N06_9 Int,

            N07_1 Int,N07_2 Int,N07_3 Int,N07_4 Int,N07_5 Int,N07_6 Int,N07_7 Int,N07_8 Int,N07_9 Int,

            N08_1 Int,N08_2 Int,N08_3 Int,N08_4 Int,N08_5 Int,N08_6 Int,N08_7 Int,N08_8 Int,N08_9 Int,

            N09_1 Int,N09_2 Int,N09_3 Int,N09_4 Int,N09_5 Int,N09_6 Int,N09_7 Int,N09_8 Int,N09_9 Int);

Go

Create Unique Clustered Index T_Netunim_Idx On T_Netunim(Mone);

Go

ונכניס לתוכה את נתוני הבעייה:

Insert Into T_Netunim(Pratim,

            N02_1,N03_1,N05_1,N06_1,N08_1,N09_1,

            N02_2,N05_2,N07_2,

            N02_3,N06_3,N07_3,

            N01_4,N02_4,N04_4,N07_4,

            N01_5,N04_5,N06_5,N09_5,

            N03_6,N04_6,N08_6,N09_6,

            N03_7,N04_7,N08_7,

            N03_8,N05_8,N08_8,

            N01_9,N02_9,N04_9,N05_9,N07_9,N08_9)

Select        'דוגמה מתוך http://www.sudoku.co.il/ רמה קלה',

            8,9,2,7,4,1,

            4,1,2,

            6,9,8,

            3,5,2,7,

            6,8,3,4,

            2,1,3,8,

            6,3,5,

            5,4,6,

            1,2,7,5,9,8;

הפרוצדורה די דומה לשליפה הארוכה שלמעלה, עם השינויים המתבקשים (היא תופעל כך: P_Sudoku 1 ואם עוצרים את הריצה לאחר מספר שניות – אפשר לקבל את ה-SQL מבלי שהוא התבצע):

Create Procedure P_Sudoku(@Mone Int) As

Declare    @SQL VarChar(Max);

 

Delete From T_Pitron Where Mone=@Mone;

 

Select    @SQL=

'Insert Into T_Pitron(Mone,'+CHAR(13)+

'            N01_1 ,N01_2 ,N01_3 ,N01_4 ,N01_5 ,N01_6 ,N01_7 ,N01_8 ,N01_9 ,'+CHAR(13)+

'            N02_1 ,N02_2 ,N02_3 ,N02_4 ,N02_5 ,N02_6 ,N02_7 ,N02_8 ,N02_9 ,'+CHAR(13)+

'            N03_1 ,N03_2 ,N03_3 ,N03_4 ,N03_5 ,N03_6 ,N03_7 ,N03_8 ,N03_9 ,'+CHAR(13)+

'            N04_1 ,N04_2 ,N04_3 ,N04_4 ,N04_5 ,N04_6 ,N04_7 ,N04_8 ,N04_9 ,'+CHAR(13)+

'            N05_1 ,N05_2 ,N05_3 ,N05_4 ,N05_5 ,N05_6 ,N05_7 ,N05_8 ,N05_9 ,'+CHAR(13)+

'            N06_1 ,N06_2 ,N06_3 ,N06_4 ,N06_5 ,N06_6 ,N06_7 ,N06_8 ,N06_9 ,'+CHAR(13)+

'            N07_1 ,N07_2 ,N07_3 ,N07_4 ,N07_5 ,N07_6 ,N07_7 ,N07_8 ,N07_9 ,'+CHAR(13)+

'            N08_1 ,N08_2 ,N08_3 ,N08_4 ,N08_5 ,N08_6 ,N08_7 ,N08_8 ,N08_9 ,'+CHAR(13)+

'            N09_1 ,N09_2 ,N09_3 ,N09_4 ,N09_5 ,N09_6 ,N09_7 ,N09_8 ,N09_9 )'+CHAR(13)+

'Select    '+Cast(@Mone As VarChar)+' Mone,'+CHAR(13)+

'        T01.N1 N01_1,'+CHAR(13)+

'        T01.N2 N01_2,'+CHAR(13)+

'        T01.N3 N01_3,'+CHAR(13)+

'        T01.N4 N01_4,'+CHAR(13)+

'        T01.N5 N01_5,'+CHAR(13)+

'        T01.N6 N01_6,'+CHAR(13)+

'        T01.N7 N01_7,'+CHAR(13)+

'        T01.N8 N01_8,'+CHAR(13)+

'        T01.N9 N01_9,'+CHAR(13)+

''+CHAR(13)+

'        T02.N1 N02_1,'+CHAR(13)+

'        T02.N2 N02_2,'+CHAR(13)+

'        T02.N3 N02_3,'+CHAR(13)+

'        T02.N4 N02_4,'+CHAR(13)+

'        T02.N5 N02_5,'+CHAR(13)+

'        T02.N6 N02_6,'+CHAR(13)+

'        T02.N7 N02_7,'+CHAR(13)+

'        T02.N8 N02_8,'+CHAR(13)+

'        T02.N9 N02_9,'+CHAR(13)+

''+CHAR(13)+

'        T03.N1 N03_1,'+CHAR(13)+

'        T03.N2 N03_2,'+CHAR(13)+

'        T03.N3 N03_3,'+CHAR(13)+

'        T03.N4 N03_4,'+CHAR(13)+

'        T03.N5 N03_5,'+CHAR(13)+

'        T03.N6 N03_6,'+CHAR(13)+

'        T03.N7 N03_7,'+CHAR(13)+

'        T03.N8 N03_8,'+CHAR(13)+

'        T03.N9 N03_9,'+CHAR(13)+

''+CHAR(13)+

'        T04.N1 N04_1,'+CHAR(13)+

'        T04.N2 N04_2,'+CHAR(13)+

'        T04.N3 N04_3,'+CHAR(13)+

'        T04.N4 N04_4,'+CHAR(13)+

'        T04.N5 N04_5,'+CHAR(13)+

'        T04.N6 N04_6,'+CHAR(13)+

'        T04.N7 N04_7,'+CHAR(13)+

'        T04.N8 N04_8,'+CHAR(13)+

'        T04.N9 N04_9,'+CHAR(13)+

''+CHAR(13)+

'        T05.N1 N05_1,'+CHAR(13)+

'        T05.N2 N05_2,'+CHAR(13)+

'        T05.N3 N05_3,'+CHAR(13)+

'        T05.N4 N05_4,'+CHAR(13)+

'        T05.N5 N05_5,'+CHAR(13)+

'        T05.N6 N05_6,'+CHAR(13)+

'        T05.N7 N05_7,'+CHAR(13)+

'        T05.N8 N05_8,'+CHAR(13)+

'        T05.N9 N05_9,'+CHAR(13)+

''+CHAR(13)+

'        T06.N1 N06_1,'+CHAR(13)+

'        T06.N2 N06_2,'+CHAR(13)+

'        T06.N3 N06_3,'+CHAR(13)+

'        T06.N4 N06_4,'+CHAR(13)+

'        T06.N5 N06_5,'+CHAR(13)+

'        T06.N6 N06_6,'+CHAR(13)+

'        T06.N7 N06_7,'+CHAR(13)+

'        T06.N8 N06_8,'+CHAR(13)+

'        T06.N9 N06_9,'+CHAR(13)+

''+CHAR(13)+

'        T07.N1 N07_1,'+CHAR(13)+

'        T07.N2 N07_2,'+CHAR(13)+

'        T07.N3 N07_3,'+CHAR(13)+

'        T07.N4 N07_4,'+CHAR(13)+

'        T07.N5 N07_5,'+CHAR(13)+

'        T07.N6 N07_6,'+CHAR(13)+

'        T07.N7 N07_7,'+CHAR(13)+

'        T07.N8 N07_8,'+CHAR(13)+

'        T07.N9 N07_9,'+CHAR(13)+

''+CHAR(13)+

'        T08.N1 N08_1,'+CHAR(13)+

'        T08.N2 N08_2,'+CHAR(13)+

'        T08.N3 N08_3,'+CHAR(13)+

'        T08.N4 N08_4,'+CHAR(13)+

'        T08.N5 N08_5,'+CHAR(13)+

'        T08.N6 N08_6,'+CHAR(13)+

'        T08.N7 N08_7,'+CHAR(13)+

'        T08.N8 N08_8,'+CHAR(13)+

'        T08.N9 N08_9,'+CHAR(13)+

''+CHAR(13)+

'        T09.N1 N09_1,'+CHAR(13)+

'        T09.N2 N09_2,'+CHAR(13)+

'        T09.N3 N09_3,'+CHAR(13)+

'        T09.N4 N09_4,'+CHAR(13)+

'        T09.N5 N09_5,'+CHAR(13)+

'        T09.N6 N09_6,'+CHAR(13)+

'        T09.N7 N09_7,'+CHAR(13)+

'        T09.N8 N09_8,'+CHAR(13)+

'        T09.N9 N09_9'+CHAR(13)+

''+CHAR(13)+

'From'+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_1 As Varchar),'')+Case When N01_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N01_2 As Varchar),'')+Case When N01_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N01_3 As Varchar),'')+Case When N01_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N01_4 As Varchar),'')+Case When N01_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N01_5 As Varchar),'')+Case When N01_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N01_6 As Varchar),'')+Case When N01_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N01_7 As Varchar),'')+Case When N01_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N01_8 As Varchar),'')+Case When N01_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N01_9 As Varchar),'')+

        ') T01,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N02_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N02_1 As Varchar),'')+Case When N02_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_2 As Varchar),'')+Case When N02_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N02_3 As Varchar),'')+Case When N02_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N02_4 As Varchar),'')+Case When N02_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N02_5 As Varchar),'')+Case When N02_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N02_6 As Varchar),'')+Case When N02_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N02_7 As Varchar),'')+Case When N02_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N02_8 As Varchar),'')+Case When N02_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N02_9 As Varchar),'')+

        ') T02,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N03_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N03_1 As Varchar),'')+Case When N03_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N03_2 As Varchar),'')+Case When N03_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_3 As Varchar),'')+Case When N03_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N03_4 As Varchar),'')+Case When N03_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N03_5 As Varchar),'')+Case When N03_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N03_6 As Varchar),'')+Case When N03_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N03_7 As Varchar),'')+Case When N03_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N03_8 As Varchar),'')+Case When N03_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N03_9 As Varchar),'')+

        ') T03,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N04_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N04_1 As Varchar),'')+Case When N04_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N04_2 As Varchar),'')+Case When N04_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N04_3 As Varchar),'')+Case When N04_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_4 As Varchar),'')+Case When N04_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N04_5 As Varchar),'')+Case When N04_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N04_6 As Varchar),'')+Case When N04_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N04_7 As Varchar),'')+Case When N04_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N04_8 As Varchar),'')+Case When N04_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N04_9 As Varchar),'')+

        ') T04,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N05_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N05_1 As Varchar),'')+Case When N05_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N05_2 As Varchar),'')+Case When N05_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N05_3 As Varchar),'')+Case When N05_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N05_4 As Varchar),'')+Case When N05_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_5 As Varchar),'')+Case When N05_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N05_6 As Varchar),'')+Case When N05_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N05_7 As Varchar),'')+Case When N05_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N05_8 As Varchar),'')+Case When N05_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N05_9 As Varchar),'')+

        ') T05,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N06_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N06_1 As Varchar),'')+Case When N06_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N06_2 As Varchar),'')+Case When N06_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N06_3 As Varchar),'')+Case When N06_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N06_4 As Varchar),'')+Case When N06_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N06_5 As Varchar),'')+Case When N06_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_6 As Varchar),'')+Case When N06_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N06_7 As Varchar),'')+Case When N06_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N06_8 As Varchar),'')+Case When N06_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N06_9 As Varchar),'')+

        ') T06,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N07_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N07_1 As Varchar),'')+Case When N07_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N07_2 As Varchar),'')+Case When N07_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N07_3 As Varchar),'')+Case When N07_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N07_4 As Varchar),'')+Case When N07_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N07_5 As Varchar),'')+Case When N07_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N07_6 As Varchar),'')+Case When N07_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_7 As Varchar),'')+Case When N07_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N07_8 As Varchar),'')+Case When N07_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N07_9 As Varchar),'')+

        ') T07,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N08_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N08_1 As Varchar),'')+Case When N08_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N08_2 As Varchar),'')+Case When N08_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N08_3 As Varchar),'')+Case When N08_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N08_4 As Varchar),'')+Case When N08_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N08_5 As Varchar),'')+Case When N08_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N08_6 As Varchar),'')+Case When N08_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N08_7 As Varchar),'')+Case When N08_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_8 As Varchar),'')+Case When N08_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N08_9 As Varchar),'')+

        ') T08,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N09_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N09_1 As Varchar),'')+Case When N09_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N09_2 As Varchar),'')+Case When N09_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N09_3 As Varchar),'')+Case When N09_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N09_4 As Varchar),'')+Case When N09_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N09_5 As Varchar),'')+Case When N09_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N09_6 As Varchar),'')+Case When N09_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N09_7 As Varchar),'')+Case When N09_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N09_8 As Varchar),'')+Case When N09_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_9 As Varchar),'')+

        ') T09,'+CHAR(13)+

''+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_1 As Varchar),'')+Case When N02_1 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_1 As Varchar),'')+Case When N03_1 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_1 As Varchar),'')+Case When N04_1 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_1 As Varchar),'')+Case When N05_1 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_1 As Varchar),'')+Case When N06_1 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_1 As Varchar),'')+Case When N07_1 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_1 As Varchar),'')+Case When N08_1 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_1 As Varchar),'')+Case When N09_1 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_1 As Varchar),'')+

        ') T11,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_2 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_2 As Varchar),'')+Case When N02_2 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_2 As Varchar),'')+Case When N03_2 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_2 As Varchar),'')+Case When N04_2 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_2 As Varchar),'')+Case When N05_2 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_2 As Varchar),'')+Case When N06_2 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_2 As Varchar),'')+Case When N07_2 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_2 As Varchar),'')+Case When N08_2 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_2 As Varchar),'')+Case When N09_2 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_2 As Varchar),'')+

        ') T12,'+CHAR(13)+        

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_3 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_3 As Varchar),'')+Case When N02_3 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_3 As Varchar),'')+Case When N03_3 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_3 As Varchar),'')+Case When N04_3 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_3 As Varchar),'')+Case When N05_3 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_3 As Varchar),'')+Case When N06_3 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_3 As Varchar),'')+Case When N07_3 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_3 As Varchar),'')+Case When N08_3 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_3 As Varchar),'')+Case When N09_3 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_3 As Varchar),'')+

        ') T13,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_4 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_4 As Varchar),'')+Case When N02_4 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_4 As Varchar),'')+Case When N03_4 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_4 As Varchar),'')+Case When N04_4 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_4 As Varchar),'')+Case When N05_4 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_4 As Varchar),'')+Case When N06_4 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_4 As Varchar),'')+Case When N07_4 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_4 As Varchar),'')+Case When N08_4 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_4 As Varchar),'')+Case When N09_4 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_4 As Varchar),'')+

        ') T14,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_5 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_5 As Varchar),'')+Case When N02_5 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_5 As Varchar),'')+Case When N03_5 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_5 As Varchar),'')+Case When N04_5 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_5 As Varchar),'')+Case When N05_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_5 As Varchar),'')+Case When N06_5 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_5 As Varchar),'')+Case When N07_5 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_5 As Varchar),'')+Case When N08_5 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_5 As Varchar),'')+Case When N09_5 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_5 As Varchar),'')+

        ') T15,'+CHAR(13)+        

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_6 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_6 As Varchar),'')+Case When N02_6 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_6 As Varchar),'')+Case When N03_6 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_6 As Varchar),'')+Case When N04_6 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_6 As Varchar),'')+Case When N05_6 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_6 As Varchar),'')+Case When N06_6 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_6 As Varchar),'')+Case When N07_6 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_6 As Varchar),'')+Case When N08_6 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_6 As Varchar),'')+Case When N09_6 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_6 As Varchar),'')+

        ') T16,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_7 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_7 As Varchar),'')+Case When N02_7 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_7 As Varchar),'')+Case When N03_7 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_7 As Varchar),'')+Case When N04_7 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_7 As Varchar),'')+Case When N05_7 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_7 As Varchar),'')+Case When N06_7 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_7 As Varchar),'')+Case When N07_7 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_7 As Varchar),'')+Case When N08_7 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_7 As Varchar),'')+Case When N09_7 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_7 As Varchar),'')+

        ') T17,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_8 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_8 As Varchar),'')+Case When N02_8 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_8 As Varchar),'')+Case When N03_8 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_8 As Varchar),'')+Case When N04_8 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_8 As Varchar),'')+Case When N05_8 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_8 As Varchar),'')+Case When N06_8 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_8 As Varchar),'')+Case When N07_8 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_8 As Varchar),'')+Case When N08_8 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_8 As Varchar),'')+Case When N09_8 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_8 As Varchar),'')+

        ') T18,'+CHAR(13)+        

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_9 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_9 As Varchar),'')+Case When N02_9 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_9 As Varchar),'')+Case When N03_9 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_9 As Varchar),'')+Case When N04_9 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_9 As Varchar),'')+Case When N05_9 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_9 As Varchar),'')+Case When N06_9 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_9 As Varchar),'')+Case When N07_9 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_9 As Varchar),'')+Case When N08_9 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_9 As Varchar),'')+Case When N09_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_9 As Varchar),'')+

        ') T19,'+CHAR(13)+

''+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_1 As Varchar),'')+Case When N02_1 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_1 As Varchar),'')+Case When N03_1 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_1 As Varchar),'')+Case When N01_2 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N01_2 As Varchar),'')+Case When N02_2 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N02_2 As Varchar),'')+Case When N03_2 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N03_2 As Varchar),'')+Case When N01_3 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N01_3 As Varchar),'')+Case When N02_3 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N02_3 As Varchar),'')+Case When N03_3 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N03_3 As Varchar),'')+

        ') T21,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N04_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N04_1 As Varchar),'')+Case When N05_1 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N05_1 As Varchar),'')+Case When N06_1 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N06_1 As Varchar),'')+Case When N04_2 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_2 As Varchar),'')+Case When N05_2 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_2 As Varchar),'')+Case When N06_2 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_2 As Varchar),'')+Case When N04_3 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N04_3 As Varchar),'')+Case When N05_3 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N05_3 As Varchar),'')+Case When N06_3 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N06_3 As Varchar),'')+

        ') T22,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N07_1 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N07_1 As Varchar),'')+Case When N08_1 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N08_1 As Varchar),'')+Case When N09_1 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N09_1 As Varchar),'')+Case When N07_2 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N07_2 As Varchar),'')+Case When N08_2 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N08_2 As Varchar),'')+Case When N09_2 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N09_2 As Varchar),'')+Case When N07_3 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_3 As Varchar),'')+Case When N08_3 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_3 As Varchar),'')+Case When N09_3 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_3 As Varchar),'')+

        ') T23,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_4 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_4 As Varchar),'')+Case When N02_4 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_4 As Varchar),'')+Case When N03_4 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_4 As Varchar),'')+Case When N01_5 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N01_5 As Varchar),'')+Case When N02_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N02_5 As Varchar),'')+Case When N03_5 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N03_5 As Varchar),'')+Case When N01_6 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N01_6 As Varchar),'')+Case When N02_6 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N02_6 As Varchar),'')+Case When N03_6 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N03_6 As Varchar),'')+

        ') T24,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N04_4 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N04_4 As Varchar),'')+Case When N05_4 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N05_4 As Varchar),'')+Case When N06_4 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N06_4 As Varchar),'')+Case When N04_5 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_5 As Varchar),'')+Case When N05_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_5 As Varchar),'')+Case When N06_5 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_5 As Varchar),'')+Case When N04_6 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N04_6 As Varchar),'')+Case When N05_6 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N05_6 As Varchar),'')+Case When N06_6 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N06_6 As Varchar),'')+

        ') T25,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N07_4 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N07_4 As Varchar),'')+Case When N08_4 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N08_4 As Varchar),'')+Case When N09_4 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N09_4 As Varchar),'')+Case When N07_5 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N07_5 As Varchar),'')+Case When N08_5 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N08_5 As Varchar),'')+Case When N09_5 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N09_5 As Varchar),'')+Case When N07_6 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_6 As Varchar),'')+Case When N08_6 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_6 As Varchar),'')+Case When N09_6 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_6 As Varchar),'')+

        ') T26,'+CHAR(13)+    

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N01_7 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N01_7 As Varchar),'')+Case When N02_7 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N02_7 As Varchar),'')+Case When N03_7 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N03_7 As Varchar),'')+Case When N01_8 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N01_8 As Varchar),'')+Case When N02_8 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N02_8 As Varchar),'')+Case When N03_8 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N03_8 As Varchar),'')+Case When N01_9 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N01_9 As Varchar),'')+Case When N02_9 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N02_9 As Varchar),'')+Case When N03_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N03_9 As Varchar),'')+

        ') T27,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N04_7 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N04_7 As Varchar),'')+Case When N05_7 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N05_7 As Varchar),'')+Case When N06_7 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N06_7 As Varchar),'')+Case When N04_8 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N04_8 As Varchar),'')+Case When N05_8 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N05_8 As Varchar),'')+Case When N06_8 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N06_8 As Varchar),'')+Case When N04_9 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N04_9 As Varchar),'')+Case When N05_9 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N05_9 As Varchar),'')+Case When N06_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N06_9 As Varchar),'')+

        ') T28,'+CHAR(13)+

        Char(9)+Char(9)+'(Select * From T_Sudoku Where 0=0'+Case When N07_7 Is Null Then '' Else ' And ' End+

        ISNULL('N1='+Cast(N07_7 As Varchar),'')+Case When N08_7 Is Null Then '' Else ' And ' End+

        ISNULL('N2='+Cast(N08_7 As Varchar),'')+Case When N09_7 Is Null Then '' Else ' And ' End+

        ISNULL('N3='+Cast(N09_7 As Varchar),'')+Case When N07_8 Is Null Then '' Else ' And ' End+

        ISNULL('N4='+Cast(N07_8 As Varchar),'')+Case When N08_8 Is Null Then '' Else ' And ' End+

        ISNULL('N5='+Cast(N08_8 As Varchar),'')+Case When N09_8 Is Null Then '' Else ' And ' End+

        ISNULL('N6='+Cast(N09_8 As Varchar),'')+Case When N07_9 Is Null Then '' Else ' And ' End+

        ISNULL('N7='+Cast(N07_9 As Varchar),'')+Case When N08_9 Is Null Then '' Else ' And ' End+

        ISNULL('N8='+Cast(N08_9 As Varchar),'')+Case When N09_9 Is Null Then '' Else ' And ' End+

        ISNULL('N9='+Cast(N09_9 As Varchar),'')+

        ') T29'+CHAR(13)+    

''+CHAR(13)+

'Where        T01.N1=T11.N1 And T01.N1=T21.N1'+CHAR(13)+

'        And T01.N2=T12.N1 And T01.N2=T21.N4'+CHAR(13)+

'        And T01.N3=T13.N1 And T01.N3=T21.N7'+CHAR(13)+

'        And T01.N4=T14.N1 And T01.N4=T24.N1'+CHAR(13)+

'        And T01.N5=T15.N1 And T01.N5=T24.N4'+CHAR(13)+

'        And T01.N6=T16.N1 And T01.N6=T24.N7'+CHAR(13)+

'        And T01.N7=T17.N1 And T01.N7=T27.N1'+CHAR(13)+

'        And T01.N8=T18.N1 And T01.N8=T27.N4'+CHAR(13)+

'        And T01.N9=T19.N1 And T01.N9=T27.N7'+CHAR(13)+

''+CHAR(13)+        

'        And T02.N1=T11.N2 And T02.N1=T21.N2'+CHAR(13)+

'        And T02.N2=T12.N2 And T02.N2=T21.N5'+CHAR(13)+

'        And T02.N3=T13.N2 And T02.N3=T21.N8'+CHAR(13)+

'        And T02.N4=T14.N2 And T02.N4=T24.N2'+CHAR(13)+

'        And T02.N5=T15.N2 And T02.N5=T24.N5'+CHAR(13)+

'        And T02.N6=T16.N2 And T02.N6=T24.N8'+CHAR(13)+

'        And T02.N7=T17.N2 And T02.N7=T27.N2'+CHAR(13)+

'        And T02.N8=T18.N2 And T02.N8=T27.N5'+CHAR(13)+

'        And T02.N9=T19.N2 And T02.N9=T27.N8'+CHAR(13)+

''+CHAR(13)+        

'        And T03.N1=T11.N3 And T03.N1=T21.N3'+CHAR(13)+

'        And T03.N2=T12.N3 And T03.N2=T21.N6'+CHAR(13)+

'        And T03.N3=T13.N3 And T03.N3=T21.N9'+CHAR(13)+

'        And T03.N4=T14.N3 And T03.N4=T24.N3'+CHAR(13)+

'        And T03.N5=T15.N3 And T03.N5=T24.N6'+CHAR(13)+

'        And T03.N6=T16.N3 And T03.N6=T24.N9'+CHAR(13)+

'        And T03.N7=T17.N3 And T03.N7=T27.N3'+CHAR(13)+

'        And T03.N8=T18.N3 And T03.N8=T27.N6'+CHAR(13)+

'        And T03.N9=T19.N3 And T03.N9=T27.N9'+CHAR(13)+

''+CHAR(13)+        

'        And T04.N1=T11.N4 And T04.N1=T22.N1'+CHAR(13)+

'        And T04.N2=T12.N4 And T04.N2=T22.N4'+CHAR(13)+

'        And T04.N3=T13.N4 And T04.N3=T22.N7'+CHAR(13)+

'        And T04.N4=T14.N4 And T04.N4=T25.N1'+CHAR(13)+

'        And T04.N5=T15.N4 And T04.N5=T25.N4'+CHAR(13)+

'        And T04.N6=T16.N4 And T04.N6=T25.N7'+CHAR(13)+

'        And T04.N7=T17.N4 And T04.N7=T28.N1'+CHAR(13)+

'        And T04.N8=T18.N4 And T04.N8=T28.N4'+CHAR(13)+

'        And T04.N9=T19.N4 And T04.N9=T28.N7'+CHAR(13)+

''+CHAR(13)+        

'        And T05.N1=T11.N5 And T05.N1=T22.N2'+CHAR(13)+

'        And T05.N2=T12.N5 And T05.N2=T22.N5'+CHAR(13)+

'        And T05.N3=T13.N5 And T05.N3=T22.N8'+CHAR(13)+

'        And T05.N4=T14.N5 And T05.N4=T25.N2'+CHAR(13)+

'        And T05.N5=T15.N5 And T05.N5=T25.N5'+CHAR(13)+

'        And T05.N6=T16.N5 And T05.N6=T25.N8'+CHAR(13)+

'        And T05.N7=T17.N5 And T05.N7=T28.N2'+CHAR(13)+

'        And T05.N8=T18.N5 And T05.N8=T28.N5'+CHAR(13)+

'        And T05.N9=T19.N5 And T05.N9=T28.N8'+CHAR(13)+

''+CHAR(13)+        

'        And T06.N1=T11.N6 And T06.N1=T22.N3'+CHAR(13)+

'        And T06.N2=T12.N6 And T06.N2=T22.N6'+CHAR(13)+

'        And T06.N3=T13.N6 And T06.N3=T22.N9'+CHAR(13)+

'        And T06.N4=T14.N6 And T06.N4=T25.N3'+CHAR(13)+

'        And T06.N5=T15.N6 And T06.N5=T25.N6'+CHAR(13)+

'        And T06.N6=T16.N6 And T06.N6=T25.N9'+CHAR(13)+

'        And T06.N7=T17.N6 And T06.N7=T28.N3'+CHAR(13)+

'        And T06.N8=T18.N6 And T06.N8=T28.N6'+CHAR(13)+

'        And T06.N9=T19.N6 And T06.N9=T28.N9'+CHAR(13)+

''+CHAR(13)+        

'        And T07.N1=T11.N7 And T07.N1=T23.N1'+CHAR(13)+

'        And T07.N2=T12.N7 And T07.N2=T23.N4'+CHAR(13)+

'        And T07.N3=T13.N7 And T07.N3=T23.N7'+CHAR(13)+

'        And T07.N4=T14.N7 And T07.N4=T26.N1'+CHAR(13)+

'        And T07.N5=T15.N7 And T07.N5=T26.N4'+CHAR(13)+

'        And T07.N6=T16.N7 And T07.N6=T26.N7'+CHAR(13)+

'        And T07.N7=T17.N7 And T07.N7=T29.N1'+CHAR(13)+

'        And T07.N8=T18.N7 And T07.N8=T29.N4'+CHAR(13)+

'        And T07.N9=T19.N7 And T07.N9=T29.N7'+CHAR(13)+

''+CHAR(13)+        

'        And T08.N1=T11.N8 And T08.N1=T23.N2'+CHAR(13)+

'        And T08.N2=T12.N8 And T08.N2=T23.N5'+CHAR(13)+

'        And T08.N3=T13.N8 And T08.N3=T23.N8'+CHAR(13)+

'        And T08.N4=T14.N8 And T08.N4=T26.N2'+CHAR(13)+

'        And T08.N5=T15.N8 And T08.N5=T26.N5'+CHAR(13)+

'        And T08.N6=T16.N8 And T08.N6=T26.N8'+CHAR(13)+

'        And T08.N7=T17.N8 And T08.N7=T29.N2'+CHAR(13)+

'        And T08.N8=T18.N8 And T08.N8=T29.N5'+CHAR(13)+

'        And T08.N9=T19.N8 And T08.N9=T29.N8'+CHAR(13)+

''+CHAR(13)+        

'        And T09.N1=T11.N9 And T09.N1=T23.N3'+CHAR(13)+

'        And T09.N2=T12.N9 And T09.N2=T23.N6'+CHAR(13)+

'        And T09.N3=T13.N9 And T09.N3=T23.N9'+CHAR(13)+

'        And T09.N4=T14.N9 And T09.N4=T26.N3'+CHAR(13)+

'        And T09.N5=T15.N9 And T09.N5=T26.N6'+CHAR(13)+

'        And T09.N6=T16.N9 And T09.N6=T26.N9'+CHAR(13)+

'        And T09.N7=T17.N9 And T09.N7=T29.N3'+CHAR(13)+

'        And T09.N8=T18.N9 And T09.N8=T29.N6'+CHAR(13)+

'        And T09.N9=T19.N9 And T09.N9=T29.N9;'

From    T_Netunim

Where    Mone=@Mone;

Print    @SQL;

Exec(@SQL);

 

Select    N01_1,N02_1,N03_1,N04_1,N05_1,N06_1,N07_1,N08_1,N09_1 From T_Pitron Where Mone=@Mone

Union All

Select    N01_2,N02_2,N03_2,N04_2,N05_2,N06_2,N07_2,N08_2,N09_2 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_3,N02_3,N03_3,N04_3,N05_3,N06_3,N07_3,N08_3,N09_3 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_4,N02_4,N03_4,N04_4,N05_4,N06_4,N07_4,N08_4,N09_4 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_5,N02_5,N03_5,N04_5,N05_5,N06_5,N07_5,N08_5,N09_5 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_6,N02_6,N03_6,N04_6,N05_6,N06_6,N07_6,N08_6,N09_6 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_7,N02_7,N03_7,N04_7,N05_7,N06_7,N07_7,N08_7,N09_7 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_8,N02_8,N03_8,N04_8,N05_8,N06_8,N07_8,N08_8,N09_8 From T_Pitron Where Mone=@Mone

Union All        

Select    N01_9,N02_9,N03_9,N04_9,N05_9,N06_9,N07_9,N08_9,N09_9 From T_Pitron Where Mone=@Mone;

Go

שעה וחצי זה הרבה או מעט?

חובב סודוקו ממוצע היה פותר את הבעייה בהרבה פחות זמן: זו בעייה יחסית פשוטה.

בהמשך כשניסיתי את כוחו של המחשב עם בעיות אחרות- זה לקח הרבה יותר זמן ונאלצתי לעצור לאחר למעלה מיממה בה החישוב לא הסתיים. כנראה שהעובדה שבכל ריבוע יש 4 נתונים ו-5 נעלמים סייעה לכך.

שורה תחתונה- כך אין פותרים בעיות סודוקו, ואין ברירה אלא למצוא פתרון חכם יותר (שיתפרסם בקרוב) ולא לנסות "בכח"..

מודעות פרסומת

להגיב »

עדיין אין תגובות.

RSS feed for comments on this post. TrackBack URI

כתיבת תגובה

הזינו את פרטיכם בטופס, או לחצו על אחד מהאייקונים כדי להשתמש בחשבון קיים:

הלוגו של WordPress.com

אתה מגיב באמצעות חשבון WordPress.com שלך. לצאת מהמערכת / לשנות )

תמונת Twitter

אתה מגיב באמצעות חשבון Twitter שלך. לצאת מהמערכת / לשנות )

תמונת Facebook

אתה מגיב באמצעות חשבון Facebook שלך. לצאת מהמערכת / לשנות )

תמונת גוגל פלוס

אתה מגיב באמצעות חשבון Google+ שלך. לצאת מהמערכת / לשנות )

מתחבר ל-%s

בלוג בוורדפרס.קום.

%d בלוגרים אהבו את זה: