Microsoft
Software
Hardware
Network
Question : cast or convert varchar to int and datetime
have two tables test and test2
test has two columns updated from csv file
sequence (nvarchar 50)
date (varchar 50)
then I need to update to test2 as this table is selected by a cube (third party report server) set up as int and datetime
sequence (int)
date (datetime)
have used the following scripts and all have failed
insert into test2
select convert (int, sequence),
convert (datetime, date) from test
Results
Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.
then tried
insert into test2
select cast (sequence as int),
cast (date as datetime) from test
Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.
then tried
insert into test2
select
convert ((int), sequence),
CONVERT(DATETIME, CONVERT(VARCHAR(MAX), [date], 101), 101)
from
test
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '('.
insert into test2
select
convert(int, sequence),
CONVERT((DATETIME), [date], 101)
from
test
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '('.
Answer : cast or convert varchar to int and datetime
there is also "FULL" and "CROSS" joins
Random Solutions
Installing Win7 Upgrade on new PC
Exchange 2007 Information store + transport + system attendant services are not start up automatically
save a webpage to file then reload from file.
Web Site Review - Ravine
Increasing Partition Size
Windows 2008 AD: Replay resistant for network access
Exchange 2k3 Mailbox limit quesiton
how is user name and password is verified in websites?
Editing table design in design view
vbscript to vb.net