Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

Table valued parameters in SqlServer 2005

Hi,
I want to use table type parameter for procedure because i need insert to to many rows(300000) quicly. This problem was solved in sqlserver 2008. I need like this code;

create proc(@tbl table(a int, b nvarchar(10))
as
begin
      insert into mytable(a,b)
      select a,b from @tbl
end

or

i change this row like to:
create proc(@tbl myTableType)
as
...
...

How can i insert to many rows in a one transaction.

I'm use ado.net 1.1(asp.net) and sqlserver 2005.

Best Regards.
0
OmerFarukZ
Asked:
OmerFarukZ
  • 4
  • 2
2 Solutions
 
OmerFarukZAuthor Commented:
And which sqldbtype must used?(ado.net not contain sqldbtype.structed)
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sql 2005 does not have this feature.
so, you must do this differently.

one possibility would be passing the data as XML, but with 30000 records to be inserted, depending on the "row size" with the xml overhead, this might get a lot of data to pass to the procedure at once...
0
 
OmerFarukZAuthor Commented:
Click for more information the structed dbtype in .net: http://msdn.microsoft.com/en-us/library/bb675163.aspx. xml idea is very logical, i try and reply to you.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
OmerFarukZAuthor Commented:
Does xml type kind of support more than 8000 characters?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Does xml type kind of support more than 8000 characters?
in sql 2005, yes. up to 2GB
0
 
Mark WillsTopic AdvisorCommented:
300,000 rows of data will be a big XML document, but as angelIII points out the XML datatype can take 2gb

Insert 300,000 rows from where ?
What is the source data that needs to be inserted ?
Is it going straight into "live" tables or using a "staging" table first ?

Might be able to use bulk insert, and a few other possible methods...
0
 
OmerFarukZAuthor Commented:
okay I'll try
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now