Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Kevin Duan,
The table numBinaryDigits is an auxiliary table that stores all possible values (1~9) and their corresponding binary values in this solution.
The UDF udfConvertBinaryToDecimalString converts a binary value to the comma delimited decimal list, just to help the output.
In the stored procedure uspSolveSudoku:
You might also want to play around with this solution by switching to table variable or physical table instead of using temporary table (#s). For using table variable, you have to make the table visible to the dynamic queries or change to using static queries. For using physical table, you can also try to use a persisted computed column instead of column "d". In this case, you need to create a function WITH SCHEMABINDING that gives the number of possible values for the v column value in the same row, the same result as "select count(*) from numBinaryDigits where (v & vBinary)>0". This could also increase the performance a bit, but not too much.
No partition elimination with sprocs?
query execution order
Query Execution Performance
Help reqd for eliminating a similar IDs- Query
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.