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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Link ODBC and DB2

Author  Topic 

ATO
Starting Member

16 Posts

Posted - 2011-09-27 : 10:42:26

Below is a statement and that I would like to select data from linked ODBC driver the ODBC linked with DB2 , Can anyone statement to work?
Sql statement
INSERT INTO [LiveDB].[dbo].[Tbl_Ins_TIS_Claimants_Data]([Claim_No],[Claimant_No],[Old_OS],[Old_Coins_OS],[previous_Years],[Data_Source])
SELECT [C2TVIA], [C2TOV], SUM([C2NETO]) AS NETO, SUM(CASE WHEN [C2HEV] = 99 THEN 0 ELSE [C2NETO] END) AS CoIns ,1,1
FROM [S65BE421].[S65BE421].[FNAHLFIL].[BRNZK2]
WHERE ([C2YYMM] = 201012 )
AND ([C2TVIA] <> 196200010008 )
GROUP BY [C2TVIA], [C2TOV]


Error msg
Cannot execute the query "SELECT "Tbl1005"."C2TVIA" "Col1079","Tbl1005"."C2TOV" "Col1080","Tbl1005"."C2HEV" "Col1083","Tbl1005"."C2NETO" "Col1087" FROM "S65BE421"."FNAHLFIL"."BRNZK2" "Tbl1005" WHERE "Tbl1005"."C2YYMM"=? AND "Tbl1005"."C2TVIA"<>(196200010008.) ORDER BY "Col1080" ASC,"Col1079" ASC" against OLE DB provider "MSDASQL" for linked server "S65BE421".

Show the ? I send number but the sqlserver send ? character

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-27 : 12:16:58
did you try this query in DB2? did it work fine there?

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

Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-28 : 02:29:24
quote:
Originally posted by visakh16

did you try this query in DB2? did it work fine there?

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





This solution is not related to the problem
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-28 : 02:32:12
quote:
Originally posted by ATO

quote:
Originally posted by visakh16

did you try this query in DB2? did it work fine there?

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






This solution is not related to the problem



it is. we need to understand whether it executes fine in DB2 if its not executing there, how do you expect it to work when executing using ODBC connection in sql server

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

Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-28 : 02:42:52
The filter parameter when the sql Executed Often change the data from
WHERE ([C2YYMM] = 201012 )
AND ([C2TVIA] <> 196200010008 )
To
WHERE "Tbl1005"."C2YYMM"=? AND "Tbl1005"."C2TVIA"<>(196200010008.)
Or
WHERE "Tbl1005"."C2YYMM"=? AND "Tbl1005"."C2TVIA"<>?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-28 : 02:47:42
is it replacing with '?' automatically? I guess its place holder for parameters?

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

Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-28 : 02:56:14
quote:
Originally posted by visakh16

is it replacing with '?' automatically? I guess its place holder for parameters?

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





Please do not repeat the same solution
Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-28 : 03:27:24
this MSG Error
The OLE DB provider "MSDASQL" for linked server "ahmed" reported an error. The provider reported an unexpected catastrophic failure.
Cannot execute the query "SELECT "Tbl1005"."C2TVIA" "Col1079","Tbl1005"."C2TOV" "Col1080","Tbl1005"."C2HEV" "Col1083","Tbl1005"."C2NETO" "Col1087" FROM "S65BE421"."FNAHLFIL"."BRNZK2" "Tbl1005" WHERE "Tbl1005"."C2YYMM"=? AND "Tbl1005"."C2TVIA"<>(196200010008.) ORDER BY "Col1080" ASC,"Col1079" ASC" against OLE DB provider "MSDASQL" for linked server "ahmed".
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-28 : 11:20:58
quote:
Originally posted by ATO

quote:
Originally posted by visakh16

is it replacing with '?' automatically? I guess its place holder for parameters?

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






Please do not repeat the same solution


which solution i repeated? Are you not able to read whats posted?
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-29 : 04:01:29
quote:
Originally posted by visakh16

quote:
Originally posted by ATO

[quote]Originally posted by visakh16

is it replacing with '?' automatically? I guess its place holder for parameters?

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






Please do not repeat the same solution


which solution i repeated? Are you not able to read whats posted?
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

I'm sorry
yes the parameters replacing with '?' automatically?
Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-29 : 04:57:52
No one helps me
Searched for this problem often
Please help me
Go to Top of Page

ATO
Starting Member

16 Posts

Posted - 2011-09-29 : 06:51:36
quote:
Originally posted by jooorj

You need to format SQL Server and install DB2-ODBC again



How to format SQL Server and install DB2-ODBC again
Note: This problem does not occur IN sqlserver 2005
Go to Top of Page
   

- Advertisement -