August 28, 2012 at 11:35 pm
Comments posted to this topic are about the item Using Sparse Columns with SELECT ... INTO
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
August 28, 2012 at 11:37 pm
Hmm...an odd thing just happened. I know that I selected the correct answers for this question but then the response was that I'd answered it incorrectly and gave an explanation why one of the answers I didn't select was wrong. Maybe I've finally gone crazy - it had to happen someday.:w00t:
Great question anyway - Thanks!
August 28, 2012 at 11:57 pm
Great question Wayne, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
August 29, 2012 at 1:00 am
Greate question Wayne..got to learn something new today 🙂
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
August 29, 2012 at 1:41 am
Good question. thanks.
August 29, 2012 at 3:29 am
Today is a good day for an education.
Thanks for the great question, learned something new.
_____________________________________________________________________
[font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]
August 29, 2012 at 5:09 am
Good question, Wayne.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
August 29, 2012 at 6:09 am
Good question. Thanks.
August 29, 2012 at 6:10 am
This was a great question. Had to do a lot of research, since I was not familiar with SPARSE, to get this one right.
August 29, 2012 at 6:40 am
Nice question.
August 29, 2012 at 7:19 am
Great question Wayne.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 29, 2012 at 7:24 am
From http://msdn.microsoft.com/en-us/library/ms174979.aspx:
SPARSE
Indicates that the column is a sparse column. The storage of sparse columns is optimized for null values. Sparse columns cannot be designated as NOT NULL. For additional restrictions and more information about sparse columns, see Use Sparse Columns.
If a sparse column cannot be designated as NOT NULL, is there a NULL/NOT NULL property to be transferred or does making the column SPARSE automatically make the column NULLable? Or does a SPARSE column have a NULL property that just cannot be changed to NOT NULL? Just wondering... :unsure:
August 29, 2012 at 7:35 am
Ernie Schlangen (8/29/2012)
From http://msdn.microsoft.com/en-us/library/ms174979.aspx:SPARSE
Indicates that the column is a sparse column. The storage of sparse columns is optimized for null values. Sparse columns cannot be designated as NOT NULL. For additional restrictions and more information about sparse columns, see Use Sparse Columns.
If a sparse column cannot be designated as NOT NULL, is there a NULL/NOT NULL property to be transferred or does making the column SPARSE automatically make the column NULLable? Or does a SPARSE column have a NULL property that just cannot be changed to NOT NULL? Just wondering... :unsure:
Run Wayne's code... aftewards do sp_help Table1 to get the structure of the table back. There's still a Nullable property.
I just never realized the Nullability of a column transferred with INTO. That's neat, just not something I ever worried about because I generally use INTO #temptables, not to make new ones, and as I"m normally dumping partial contents of tables into the #temp, the values are what I'm normally more interested in.
August 29, 2012 at 7:38 am
Thanks for the quick answer! I suspected that I would get an answer here before I had time to try to find it myself!:-D
Viewing 15 posts - 1 through 15 (of 27 total)
You must be logged in to reply to this topic. Login to reply