Wrox Programmer Forums
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2007, 12:32 AM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Insert

Hi,
   How can i insert a variable along with the value passed from a stored proc, ie. i want to pass both of them together into a table at the same time. I am using sql server 2005.

eg.

declare @extracol INT
set @extracol = 4

create table #bob_output
(
    userID varchar(100),
    extracol INT
)

INSERT INTO #bob_output(userID) exec bob
SELECT * from #bob_output

DROP TABLE #bob_output

This code works fine but if i want to do something like the foll it fails. Pls help with syntax:

declare @extracol INT
set @extracol = 4

create table #bob_output
(
    userID varchar(100),
    extracol INT
)

INSERT INTO #bob_output(userID,extracol) exec bob,@extracol ******????
SELECT * from #bob_output

DROP TABLE #bob_output

Cheers,
Kavitha

 
Old September 26th, 2007, 11:20 PM
Authorized User
 
Join Date: Sep 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra
Default

I wonder why are u using a comma between procedure name & parameter?

Cheers,
Prabodh





Similar Threads
Thread Thread Starter Forum Replies Last Post
INSERT SQL donevco Access 2 February 9th, 2007 06:37 PM
SQL Insert C# N4th SQL Server 2000 6 December 5th, 2006 05:28 AM
how to create insert sql aji SQL Language 4 June 23rd, 2005 06:41 PM
how to insert into SQL table p2ptolu Classic ASP Databases 1 June 17th, 2005 06:52 AM
SQL INSERT mattastic Classic ASP Databases 3 February 24th, 2005 07:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.