Hi i am trying to export data from .csv file to sql server and my data is coming as
"xyz" where i want only to store as XYZ i am using derived column but i am not able to capture " and replace it what approach should i take here , also i am trying to convert String True to Boolean 1 and vice versa for False in database how do i do that please help me with this.
Look at the REPLACE function. Also, aren't you specifying (") as the text qualifier in your file setup?
As for converting the string True/False to boolean, you can use conditionals in a derived column. [Column] = "True" ? 1 : 0
You might just be able to cast the column, though I'm not sure. You'll have to test that out.
|||Big Thanks for the Help ... it works .|||I am trying to store the value of True or False in a bit field in sql server which will be 1 for true and 0 false .. i am confused as to whether i need to cast it before storing it . please guide me.
From the Data Viewer i can see the Values changing to 1 and 0 but how do i store them as bit datatype in sql server
|||
Dev2624 wrote:
I am trying to store the value of True or False in a bit field in sql server which will be 1 for true and 0 false .. i am confused as to whether i need to cast it before storing it . please guide me.
From the Data Viewer i can see the Values changing to 1 and 0 but how do i store them as bit datatype in sql server
It should just work. If the values are 1s and 0s. Have you tried it!?|||I tried and it is storing as True in the column value but not as 1 in sql server , i am not aware of how exactly bit datatype works|||
Dev2624 wrote:
I tried and it is storing as True in the column value but not as 1 in sql server , i am not aware of how exactly bit datatype works
If the column's data type is "bit" it isn't storing as "True" or "False." However you're verifying the results, it's that application that's *presenting* the data as True/False. The underlying data is stored as 0 or 1.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1079022&SiteID=1|||It was a big help Thanks!!!
No comments:
Post a Comment