Click here to Skip to main content
13,147,689 members (32,264 online)
Rate this:
 
Please Sign up or sign in to vote.
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 21:33pm
daghune867
Updated 29-Aug-12 21:35pm
v2
Comments
Rajesh Anuhya 30-Aug-12 3:35am
   
Pre tags added.
--RA
daghune 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 30-Aug-12 3:42am
   
thank you _Amy
__TR__ 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 30-Aug-12 4:46am
   
Yes you are right. Now he can use the procedure easily. Thank you. :)
__TR__ 30-Aug-12 5:02am
   
5ed!
daghune 30-Aug-12 5:50am
   
thanks pro
daghune 30-Aug-12 4:38am
   
could you write for me c# code that use this sp and fill datagridview with it??
aspnet_regiis 30-Aug-12 4:50am
   
Yes. Someone will surely write this code for you if you give him your one day's salary....
daghune 30-Aug-12 5:33am
   
lashgushhhhhhhhhhhh
daghune 30-Aug-12 5:37am
   
The scientist has to publish his knowledge and Ignorant people are scared of publishing their knowledge................
aspnet_regiis 30-Aug-12 7:03am
   
You are right.. Some hundred thousand 'scientists' have already published their knowledge here . Check here
_Amy 30-Aug-12 7:21am
   
Thumbs up. :)
aspnet_regiis 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 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 30 Aug 2012
Copyright © CodeProject, 1999-2017
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