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
 cast/convert question

Author  Topic 

SSG
Starting Member

4 Posts

Posted - 2009-09-15 : 08:51:41
I have several SQL tables, which will eventually update to a DB2 file ( using linked servers). The SQL is erroring on the
"cast(convert(nvarchar,EndDate,112)as INT)as LEACDT"
line of the code. I am receiving error #7343 on this line. I am not sure why I am receiving an error on this.

The date coming from the SQL Table is in this format:

4/20/2003
4/27/2009
5/1/2009

The date on the DB2 file is defined as
LEACDT 8 0 ( signed )


Here is the piece of the SQL Code:

-- Post timecard hours
INSERT
dbo.vwWMLEPF
SELECT
tblTimecard.DivisionID As LEDVCD,
BatchID As LELHID,
DetailIndex As LEID,
SS As LELBID,
CAST(convert(nvarchar, EndDate, 112) As INT) As LEACDT,
UPPER(WOID) As LEWRID,
'A' As LEPHSE,-- Phase
'G' As LETGCD,-- TechGroup
tblTimecardDetail.ActivityCode As LEACCD,

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-15 : 09:06:58
maybe your config isn't fitting?
Try to use
set language english
before your insert statement


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

SSG
Starting Member

4 Posts

Posted - 2009-09-15 : 09:46:11
It will let me type SET, but nothing after that. According to the server properties the default is English. Here is another question referring to the same error. This query is using 4-5 diff SQL tables for input of data elements. Within the SELECT statement, should the data elements from the same tables be grouped together or does it not matter?


quote:
Originally posted by webfred

maybe your config isn't fitting?
Try to use
set language english
before your insert statement


No, you're never too old to Yak'n'Roll if you're too young to die.

Go to Top of Page
   

- Advertisement -