Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

COnverting COlumn Data Type from Varchar to Date

$
0
0

I have DATA in text file, which when i try to import into SQL table the data type for the DATA column comes a s Varchar. 

I want this Date Column DATA type to be Date.

I tried Converting the DATA type while Importing using Import Wizard and also tried the same thing While importing the text file using the SSIS Package DATA conversion, but getting an error "Conversion failed when converting date and/or time from character string."

I tried to change the DATA type to Date using the below SQL Query after importing the text file to SQL table.

Alter table TestingDB.dbo.Calls_Calls
Alter column [Date] Date

Still getting the same error "Conversion failed when converting date and/or time from character string."

Need help to Convert the Varchar data type to Date while importing the data to SQL table, As i will be scheduling a Job to import this text file data to SQL table every 1 Hour

Any help will be  appreciated 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>