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

Cast /Covert from nvarchar to varchar...during select in oledb src Expand / Collapse
Author
Message
Posted Wednesday, November 05, 2008 2:29 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, April 25, 2012 12:30 PM
Points: 323, Visits: 800


Hi all,


I have my source columns as nvarchar type and want to cast them while select ting to varchar ....how can i do this in se;ect clause itself, i don't want to use a dataconversion after oledb src...

Any help on this?

thanks



---------------------------------------------------

Thanks
Post #597705
Posted Wednesday, November 05, 2008 7:56 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,893, Visits: 26,771
If the NVARCHAR column has no multi-lingual entries (the main purpose for NVARCHAR), the a simple SELECT CAST(columnname AS VARCHAR(x)) where x is the desired maximum length should work. Please refer to CONVERT or CAST in Books OnLine for additional information on such conversions.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #597825
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse