Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2007-01-02 : 11:15:39
|
I have table which include many records in it.Example:Table A (ID integer,Name nvarchar(30),Age text,Sex nvarchar(10))ID======Name======Age======Sex1 ======A=========24=======Female2 ======B=========35=======Male3 ......My problems : I want to export entire data above to sql file whichhave following format :Insert into TableB(ID,Name,Age,Sex) values(1,'A','24','Female')Insert into TableB(ID,Name,Age,Sex) values(2,'B','35','Male').....Any one help me ?Thank you very much. |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-01-02 : 11:20:53
|
Do you want to copy the data to another tableInsert into TableB(ID,Name,Age,Sex) select ID, Name, Age, Sex from TableAor to a file - in which case have a look at bcpmaster..xp_cmdshell 'bcp mydb..TableA out c:\TableA.txt -SMyserver -T -c -t,'==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
pamyral_279
Posting Yak Master
143 Posts |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-02 : 22:50:22
|
Make use of OSQL command-line utility.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-02 : 23:09:56
|
Copy the result in QA to a text file.Peter LarssonHelsingborg, Sweden |
|
|
sudhirpayal
Starting Member
1 Post |
Posted - 2007-03-23 : 17:44:13
|
Hi,I want to insert specific rows.I tried using exec generate_inserts D_time,'','', from = (select * from D_time where time_id>20070000) but thats not working.Has anybody any idea how to use the insert statements using where clause.. |
|
|
|
|
|
|
|