Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008
hello all pro
excuse me for this question but i m a beginner i have this error when execute my stored procedure:
Incorrect syntax near the keyword 'Table'
this is my sp:
 
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE Sp_GetPersonVsFinanc
@source Table output
AS
BEGIN
	SET NOCOUNT ON;
	SELECT p.Id,p.Name,p.Family,f.DebtValue,f.BestankarValue
	into source
	from tbl_PersonInfo p join Financial f 
	on p.Id = f.FinancialPersonID
END
GO
Posted 29-Aug-12 22:33pm
daghune815
Edited 29-Aug-12 22:35pm
v2
Comments
Rajesh Anuhya at 30-Aug-12 3:35am
   
Pre tags added.
--RA
daghune at 30-Aug-12 3:39am
   
CREATE PROCEDURE Sp_GetPersonVsFinanc
@source Table output
AS
BEGIN
SET NOCOUNT ON;
SELECT p.Id,p.Name,p.Family,f.DebtValue,f.BestankarValue
into source
from tbl_PersonInfo p join Financial f
on p.Id = f.FinancialPersonID
END

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try this:
CREATE PROCEDURE Sp_GetPersonVsFinanc
AS
BEGIN
	SELECT p.Id,p.Name,p.Family,f.DebtValue,f.BestankarValue
	from tbl_PersonInfo p join Financial f 
	on p.Id = f.FinancialPersonID
END
GO
You don't suppose to add @source Table output, Select command will take care of returning records.
 

--Amit
  Permalink  
v3
Comments
daghune at 30-Aug-12 3:42am
   
thank you _Amy
__TR__ at 30-Aug-12 3:45am
   
Hi,
I think the above 'select into' statement will create a 'source' table and give an error when it is executed again. So it would be better if we use #source.
SELECT p.Id,p.Name,p.Family,f.DebtValue,f.BestankarValue
into #source
from tbl_PersonInfo p join Financial f
on p.Id = f.FinancialPersonID
 
Also i think there is no point inserting it into another table, we can just query the tables and get the result. I hope i am making sense.
_Amy at 30-Aug-12 4:46am
   
Yes you are right. Now he can use the procedure easily. Thank you. :)
__TR__ at 30-Aug-12 5:02am
   
5ed!
daghune at 30-Aug-12 5:50am
   
thanks pro
daghune at 30-Aug-12 4:38am
   
could you write for me c# code that use this sp and fill datagridview with it??
aspnet_regiis at 30-Aug-12 4:50am
   
Yes. Someone will surely write this code for you if you give him your one day's salary....
daghune at 30-Aug-12 5:33am
   
lashgushhhhhhhhhhhh
daghune at 30-Aug-12 5:37am
   
The scientist has to publish his knowledge and Ignorant people are scared of publishing their knowledge................
aspnet_regiis at 30-Aug-12 7:03am
   
You are right.. Some hundred thousand 'scientists' have already published their knowledge here . Check here
_Amy at 30-Aug-12 7:21am
   
Thumbs up. :)
aspnet_regiis at 30-Aug-12 7:28am
   
:) .. I am wondering why Apple sued Samsung for Pinch Zoom patent while I have been pinching my classmates in school ever since my nursery, pre-school classes...Apple is so ignorant about pinching...
member60 at 30-Aug-12 4:48am
   
My 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 30 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100