Hello everybody,
I was wondering if there is a way to export and recode data at the same time with SQL.
For example I have gender information coded as 1 or 2 in my table and I need to upload the information to a different application that needs M or F. Is there a way to export to a new table and recode at the same time ?
I'm still pretty new to it.
Thank you.
-SebData Transformation Services (DTS) and choose the use a query to specify the data transfer and then use a CASE statement (CASE WHEN field = 1 THEN "M" ELSE "F" END).
Easy peasy.|||I'd use something like:SELECT
CASE
WHEN 1 = gender THEN 'F'
WHEN 2 = gender THEN 'M'
ELSE '?'
END AS morf
FROM myTable-PatP|||Or if you are more old-school, you can use bcp with the queryout functionality. For less bulky command line commands, you can create a view in SQL server of the query you want, then export the view.
But then, is there really that good a market for skinned cats?|||Thank you guys that helps a lot. -Seb|||But then, is there really that good a market for skinned cats?There's more ways to skin a cat than there are cats... But that's no reason to stop trying to find new ways!
-PatPsql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment