SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 compare string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shanmugaraj
Posting Yak Master

219 Posts

Posted - 04/17/2013 :  08:13:47  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 04/17/2013 :  08:20:06  Show Profile  Reply with Quote
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 - 04/17/2013 :  08:22:08  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 04/17/2013 :  08:37:11  Show Profile  Reply with Quote
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 - 04/17/2013 :  09:57:27  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000