Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 CHECK MULTIPLE COLUMN

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2013-11-12 : 10:28:49

HI,
I TRY TO CHECK MULTIPLE COLUMN CHECK IN TABLE, BUT ITS NOT WORKING
PROPERLY PLS GUIDE ME

IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'deathdata' AND COLUMN_NAME IN( 'donationstitle','donationsto','donaddress','doncity','donstate','donzip'))
BEGIN

Desikankannan

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-11-12 : 10:39:48
please take your caps lock off and explain what you are trying to do and what is not working. Are you getting an error message? If so post it. Assuming you have an END with content within the begin/end then I don't see a problem with your code. You just need to know that if any of those columns exists the EXISTS will return true. It will only return false when none of those columns exist.

Be One with the Optimizer
TG
Go to Top of Page

desikankannan
Posting Yak Master

152 Posts

Posted - 2013-11-12 : 11:37:14
HI

I GOT THE ANSWER
MY SQL QUERY IS WRONG


quote:
Originally posted by TG

please take your caps lock off and explain what you are trying to do and what is not working. Are you getting an error message? If so post it. Assuming you have an END with content within the begin/end then I don't see a problem with your code. You just need to know that if any of those columns exists the EXISTS will return true. It will only return false when none of those columns exist.

Be One with the Optimizer
TG



Desikankannan
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-12 : 12:53:08
quote:
Originally posted by desikankannan

HI

I GOT THE ANSWER
MY SQL QUERY IS WRONG


quote:
Originally posted by TG

please take your caps lock off and explain what you are trying to do and what is not working. Are you getting an error message? If so post it. Assuming you have an END with content within the begin/end then I don't see a problem with your code. You just need to know that if any of those columns exists the EXISTS will return true. It will only return false when none of those columns exist.

Be One with the Optimizer
TG



Desikankannan


Are you aware that using caps means shouting?
Please refrain from using caps in future.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -