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 |
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-05-14 : 01:17:42
|
| hi all i have table which has a userid,email and other fields.And i have a text file called email.txt,this text file has userid and email values corresponding to those in the table.And this file has only this userid and email fields separated by commas..for example1,jwalton@uswest.net2,jeff@hmhr.com3,james@hotmail.com And i need to update the emailid field in table with the emailid in this text file.ok tanx in advance... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-14 : 01:45:30
|
| You can export the text file to a staging table in your database using DTS and then use Execute SQL task to update emailids in your table from staging table. |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-05-14 : 02:12:01
|
| hi visakh, is it possible thru query...ok tanx |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-14 : 02:19:26
|
Yup. You can use OPENROWSET and get text data to temporary table and use it to update your table.INSERT INTO #TempSELECT * FROM OPENROWSET(BULK N'YourTextfilepath', SINGLE_BLOB) UPDATE ytSET yt.Email=t.EmailFROM YourTable ytINNER JOIN #Temp tON t.userid=yt.userid |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-05-14 : 02:29:43
|
| hi visakh, tanx for ur help..i have a doubt..i am using sql2000.will ur query run in 2k also..oktanx... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-14 : 02:34:01
|
| Dont think you have BLOB option in 2000. You can also refer this:-http://www.mssqltips.com/tip.asp?tip=1207 |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-05-14 : 02:43:09
|
| ok then how can i do the above task in sql2k thru query.can u help me....ok tanx...... |
 |
|
|
|
|
|