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
 changing format of data before importing to SQL

Author  Topic 

goligol
Posting Yak Master

128 Posts

Posted - 2011-11-01 : 11:36:57
I have an excel table which has two columns. in Excel I have set the column format to be text, but when I am importing to SQL it showns the type of one of the column as float, when I manually change it to "nvarcahr" in destination source it doesnt like it. Is there any way that I can change the type of the data before importing it to SQL.

Thank you

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-01 : 11:39:31
how are you importing data? through OPENROWSET or using SSIS?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

goligol
Posting Yak Master

128 Posts

Posted - 2011-11-01 : 11:47:12
I do right click on database, select task->import data->select excel engine as source of the data->select the sheet to be imported-> ...
there is a tab which says "edit SQL" I go there and change the data from float to nvarcahr type but it doesnt go through and give some error since the origin source of data is not nvarchar.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-01 : 11:50:02
quote:
Originally posted by goligol

I do right click on database, select task->import data->select excel engine as source of the data->select the sheet to be imported-> ...
there is a tab which says "edit SQL" I go there and change the data from float to nvarcahr type but it doesnt go through and give some error since the origin source of data is not nvarchar.


ok so its export import wizard.
you cant apply much changes here.
best way is to save the package created and then open it in business intelligence studio and then add a data type conversion or derived column task between excel source and destination to do the data type conversion

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -