How can I generate sql script with data in sql server 2000?

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2009
Posts: 9
Reputation: jineesh is an unknown quantity at this point 
Solved Threads: 0
jineesh jineesh is offline Offline
Newbie Poster

How can I generate sql script with data in sql server 2000?

 
0
  #1
Jun 8th, 2009
Please any one help me...
I want to insert data automatically to the table while installing an application. how can i do this? Can I generate sql script for this???


Regards
Jineesh
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 97
Reputation: VIeditorlover is an unknown quantity at this point 
Solved Threads: 5
VIeditorlover's Avatar
VIeditorlover VIeditorlover is offline Offline
Junior Poster in Training

Re: How can I generate sql script with data in sql server 2000?

 
0
  #2
Jun 8th, 2009
Originally Posted by jineesh View Post
Please any one help me...
I want to insert data automatically to the table while installing an application. how can i do this? Can I generate sql script for this???


Regards
Jineesh

It depends on how big is the data you are dealing with. For example few lines can be inserted handy written script.

Few hundred lines can be inserted from script-generated sql script like:
  1. declare @crlf varchar(2)
  2. set @crlf = char(13)+char(10)
  3. select 'insert into tab1 (a,b,c) values (''' +a+''','''+b+''','''+c''');'+crlf;
  4. from tab1
  5. where /* add filter here*/

for 1000+ you can store data into Excel table and import it very simple way (see http://horizon.leadhoster.com/?content=tipstricks topic Fast and simple import data from Excel table into SQL server ) or XML and process data on the server within stored procedure or with XQuery http://blogs.msdn.com/mrorke/ see Dynamic XQuery Expressions.

Finally for 100000+ I would reccommend you distribute whole database file (mdf+ldf) and during installation just unpack it and attach (works perfectly!).
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC