Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Insert A List OF Data To sql Expand / Collapse
Author
Message
Posted Saturday, September 22, 2012 6:21 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 6, 2014 6:12 AM
Points: 53, Visits: 165
I write bellow query For Insert Data but I want my Store Procedure take A List OF Data and insert it.how can i change That?


create procedure AtashSooziFloorInsert
@AtashSooziID int,@FloorID int
as
begin
insert AtashSooziFloor (AtashSooziID,FloorID)
values(@AtashSooziID,@FloorID)
end

Post #1363100
Posted Saturday, September 22, 2012 7:21 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, September 18, 2014 7:50 PM
Points: 5,322, Visits: 25,235
To assist those who desire to assist you, could you supply a short sample of the "list of data" that you need to insert.

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1363103
Posted Saturday, September 22, 2012 8:16 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 4:34 AM
Points: 231, Visits: 740
SELECT 'EXECUTE AtashSooziFloorInsert ' + CAST(AtashSoozId as varchar(100))+ '
CASTFloorID as varchar(100)) FROM ImportedTable

then you can execute this list of sql
or you write a cursor and then execute all sql
Post #1363105
Posted Sunday, September 23, 2012 2:55 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 2:06 AM
Points: 1,768, Visits: 8,318
Sounds like a table valued parameter is your friend here.




Clear Sky SQL
My Blog
Kent user group
Post #1363206
Posted Thursday, September 27, 2012 11:06 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 6, 2014 6:12 AM
Points: 53, Visits: 165
tnx Dave Ballantyne
Post #1365605
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse