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.
| Author |
Topic |
|
scared
Starting Member
14 Posts |
Posted - 2007-06-22 : 14:25:57
|
| Here I am creating a temp table with $ summations that I can later join with an employees table that I'm dumping into a flat file.select e.employee_no, sum(p.fit) as sumfit, sum(p.fica) - sum(p.medicare) as sumfica, sum(p.medicare) as sumedic, sum(p.fit_earnings) as pearnings, sum(p.fit_earnings) as tearningsinto #earntablefrom employees as e left outer join pay_summary as p on e.employee_no =p.employee_nowhere e.employee_no = 817 and dateadd(d, 0, datediff(d, 0, p.dated)) between '20061231'and '20070401'group by e.employee_noselect * from #earntable When I go to look at the contents of the #earntable with the above select, I get this:ODBC error 214 Procedure expects parameter '@handle' of type 'int'.(42000)The datatypes I'm trying to select into the temp table are allnumeric 12 except employee_no char 10.What am I missing? A drop table statement? |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-22 : 14:33:39
|
If employee_no is char e.employee_no = 817 should bee.employee_no = '817' Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-22 : 14:35:17
|
| And you might want to use varchar(10) instead of char(10). char padds the values with extra spaces to make it fixed width, which can also cause problems when querying because '817' will not be same as '817 '.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
cvraghu
Posting Yak Master
187 Posts |
Posted - 2007-06-22 : 15:38:04
|
| Can you provide complete picture? How/Where are you executing this - in Query analyzer? Is it part of SP? |
 |
|
|
scared
Starting Member
14 Posts |
Posted - 2007-06-22 : 16:45:41
|
quote: Originally posted by cvraghu Can you provide complete picture? How/Where are you executing this - in Query analyzer? Is it part of SP?
That is the complete picture: every word of code, not one more or one less. I fixed the select statement for the char employee_no, that's all. Not a stored procedure, just a query to try to create a temp table and then look at the contents afterwards.Sigh. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-22 : 16:54:56
|
| Did fixing the employee_no give expected result?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-06-22 : 16:57:04
|
quote: Originally posted by scared
quote: Originally posted by cvraghu Can you provide complete picture? How/Where are you executing this - in Query analyzer? Is it part of SP?
That is the complete picture...
sigh...Since you didn't even answer the question about how you are running it, the picture is not complete.CODO ERGO SUM |
 |
|
|
|
|
|
|
|