busterkarmul
Programmer
Hello,
Here is the code in an Access 2003 module which is converting a value on a SQL Server 2005 table (tbl_ProjectSteps):
x = DCount("[Key]", "tbl_ProjectSteps", "[numProjID]=" & recCurrentTask.numProjID & " AND " & _
"CLng(Left([Key],InStr(1,[Key],'.')))=" & CLng(str_TaskID))
Here is the query in the SQL Profiler Trace:
SELECT COUNT("Key" )
FROM "dbo"."tbl_ProjectSteps" --count = 1927
WHERE (("numProjID" = 1910 ) --count = 87
AND ({fn convert({fn left("Key",{fn locate('.' ,"Key" ,1 )})},SQL_INTEGER)}= 1) )
I get this error:
Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the nvarchar value '1.' to data type int
The [key] field in the SQL Server 2005 database table is nvarchar(255) and contains values like 1.0. 1.0.1, etc.
I've been researching this online and cannot seem to find a definitive answer. Any ideas?
Thanks,
Buster
Here is the code in an Access 2003 module which is converting a value on a SQL Server 2005 table (tbl_ProjectSteps):
x = DCount("[Key]", "tbl_ProjectSteps", "[numProjID]=" & recCurrentTask.numProjID & " AND " & _
"CLng(Left([Key],InStr(1,[Key],'.')))=" & CLng(str_TaskID))
Here is the query in the SQL Profiler Trace:
SELECT COUNT("Key" )
FROM "dbo"."tbl_ProjectSteps" --count = 1927
WHERE (("numProjID" = 1910 ) --count = 87
AND ({fn convert({fn left("Key",{fn locate('.' ,"Key" ,1 )})},SQL_INTEGER)}= 1) )
I get this error:
Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the nvarchar value '1.' to data type int
The [key] field in the SQL Server 2005 database table is nvarchar(255) and contains values like 1.0. 1.0.1, etc.
I've been researching this online and cannot seem to find a definitive answer. Any ideas?
Thanks,
Buster