SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Computed columns Data Types


Computed columns Data Types

Author
Message
sqldoubleg
sqldoubleg
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1799 Visits: 1363
Comments posted to this topic are about the item Computed columns Data Types
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (111K reputation)SSC Guru (111K reputation)SSC Guru (111K reputation)SSC Guru (111K reputation)SSC Guru (111K reputation)SSC Guru (111K reputation)SSC Guru (111K reputation)SSC Guru (111K reputation)

Group: General Forum Members
Points: 111242 Visits: 13338
Very interesting question, thanks.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27382 Visits: 7545
Interesting question, thanks

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Igor Micev
Igor Micev
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15770 Visits: 5178
Nice question!
Thanks

Igor Micev,
My blog: www.igormicev.com
Carlo Romagnano
Carlo Romagnano
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10002 Visits: 3465
Optimum!
Bob JH Cullen
Bob JH Cullen
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1274 Visits: 786
the function LEFT can return NULL values therefore the computed column is created as NULL

Just how can LEFT return a NULL when operating on a CHAR(8) NOT NULL value??
Gazareth
Gazareth
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12488 Visits: 6070
Raul! How's it going?
Nice question :-)

Gaz
Gazareth
Gazareth
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12488 Visits: 6070
Bob Cullen-434885 (11/15/2013)
the function LEFT can return NULL values therefore the computed column is created as NULL

Just how can LEFT return a NULL when operating on a CHAR(8) NOT NULL value??


I think it's that the LEFT function definition itself is not guaranteed to return a not null value, rather than being evaluated based on the particular column/usage.
sqldoubleg
sqldoubleg
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1799 Visits: 1363
Gazareth (11/15/2013)
Bob Cullen-434885 (11/15/2013)
the function LEFT can return NULL values therefore the computed column is created as NULL

Just how can LEFT return a NULL when operating on a CHAR(8) NOT NULL value??


I think it's that the LEFT function definition itself is not guaranteed to return a not null value, rather than being evaluated based on the particular column/usage.


Hi Gaz, how you doing!

You're right, the function LEFT() can return NULL values, so it doesn't really matter if in this case, being the column defined as NOT NULL, it will never return NULL, the expression will be NULLable anyway

SELECT LEFT(NULL, 4)



Cheers
Bob JH Cullen
Bob JH Cullen
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1274 Visits: 786
Raul, Gaz, thanks both. I should have known better than to assume SQL would apply some intelligence to the expression analysis! ;-)
Odd, though, in the table designer, how the 'Allow Nulls' and 'Data Type' attributes get blanked for computed columns - no hints at all there about what is going on in its tiny mind...
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search