Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query -- Help Expand / Collapse
Author
Message
Posted Tuesday, December 17, 2013 7:12 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, September 26, 2014 7:36 AM
Points: 229, Visits: 730
Hi Team,

Please help in below query, it should return TRUE.


DECLARE @req_1 varchar(50)
DECLARE @req_2 varchar(50)

set @req_1='AAM'
set @req_2='VVE'

if (@req_1 !='AAM' OR @req_2 !='VVE')
print 'TRUE'
ELSE
print 'FALSE'

Post #1523674
Posted Tuesday, December 17, 2013 7:32 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:23 AM
Points: 12,992, Visits: 12,406
Minnu (12/17/2013)
Hi Team,

Please help in below query, it should return TRUE.


DECLARE @req_1 varchar(50)
DECLARE @req_2 varchar(50)

set @req_1='AAM'
set @req_2='VVE'

if (@req_1 !='AAM' OR @req_2 !='VVE')
print 'TRUE'
ELSE
print 'FALSE'



What is the business rule you are trying to achieve here? Look at your logic..

Both conditions are false.


_______________________________________________________________

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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1523681
Posted Tuesday, December 17, 2013 10:32 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:28 PM
Points: 332, Visits: 199
-- Not sure what the Business requirement is but for you to get the output as TRUE, use this:

DECLARE @req_1 varchar(50)
DECLARE @req_2 varchar(50)

set @req_1='AAM'
set @req_2='VVE'

if (@req_1 ='AAM' OR @req_2 ='VVE')
print 'TRUE'
ELSE
print 'FALSE'
Post #1523807
Posted Tuesday, December 17, 2013 10:37 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:23 AM
Points: 12,992, Visits: 12,406
Or maybe this...

if (@req_1 !='AAM' AND @req_2 !='VVE')
print 'TRUE'
ELSE
print 'FALSE'

It all depends on what you are trying to do here.




_______________________________________________________________

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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1523810
Posted Wednesday, December 18, 2013 2:56 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 8:21 AM
Points: 586, Visits: 2,740
Minnu (12/17/2013)
Hi Team,

Please help in below query, it should return TRUE.


DECLARE @req_1 varchar(50)
DECLARE @req_2 varchar(50)

set @req_1='AAM'
set @req_2='VVE'

if (@req_1 !='AAM' OR @req_2 !='VVE')
print 'TRUE'
ELSE
print 'FALSE'



It's worth noting that you should replace the non-standard syntax: != with <>.


-- Alan Burstein



Read this article for best practices on asking questions.
Need to split a string? Try this (Jeff Moden)
Need a pattern-based string spitter? Try this (Dwain Camps)
My blog
Post #1524365
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse