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
 General SQL Server Forums
 New to SQL Server Programming
 compare string

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2013-04-17 : 08:13:47
i need syntax to return text not in 2nd parameter based on sepeartor ","



for eg:

variable1 = 'Name,Age,Gender'

variable2 = 'Age,Location,Name,Designation'

i want to have an select query to return the value as 'Location,Designation'

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-17 : 08:20:06
One thing you do.... While forming comma separated values use ORDER BY clause then you can easily get the remaining part

--
Chandu
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2013-04-17 : 08:22:08
These are comming from other xml source, i cant change them. need to check in query only

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-17 : 08:37:11
you are using FOR XML PATH to get CSV form... right?

SELECT (SELECT ','+COLUMN_NAME
FROM information_schema.columns
WHERE table_name = 'temp_main' and COLUMN_NAME not in (SELECT COLUMN_NAME FROM information_schema.columns WHERE table_name = 'temp_dynamic')
ORDER BY Column_name
FOR XML PATH(''))


--
Chandu
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2013-04-17 : 09:57:27
No, this is for the scenario of variable coming from script based on csv header column comparing against table column header.
so, i have one variable for table column header, variable for csv column header.
need to compare both the variables for finding the missing column header in the csv

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page
   

- Advertisement -