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 |
|
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2010-03-03 : 00:45:36
|
| Dear All,I need an sql to update a table pgStatusStart & pgStatusEnd As Below:-Before:********No pgStatusStart pgStatusEnd------------------------------------1. Null Null2. Null Null3. Null Null4.::10. Null Null11. Null Null12. Null Null::20. Null NullAfter:*******No pgStatusStart pgStatusEnd------------------------------------1. y Null2. Null Null3. Null Null4.::10. Null y11. y Null12. Null Null::20. Null y ::Please help me. Thank you.Regards,Micheale |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-03-03 : 00:47:41
|
| What is the basis for the update?PBUH |
 |
|
|
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2010-03-03 : 00:51:51
|
quote: Originally posted by Idera What is the basis for the update?PBUH
Update 10 record each for pgStatusStart & pgStatusEndeg: ID 1 --> pgStatusStart=yID 10 --> pgStatusnd=yID 11 --> pgStatusStart=yID 20 --> pgStatusEnd=yID 21 --> pgStatusStart=yID 30 --> pgStatusnd=yID 31 --> pgStatusStart=yID 40 --> pgStatusEnd=y:: |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-03-03 : 00:53:56
|
| [code]is this u wantDECLARE @i TABLE (id INT IDENTITY(1,1),pgstart VARCHAR(12), pgend VARCHAR(12))INSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLINSERT INTO @i SELECT NULL ,NULLUPDATE @iSET pgstart = 'y'WHERE (id%10) = 1UPDATE @iSET pgend = 'y'WHERE (id%10) = 0SELECT * FROM @i[/code] |
 |
|
|
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2010-03-03 : 01:01:17
|
| Dear bklr,It's work Fine now.Thank you very much.Cheers,Micheale |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-03-03 : 01:02:45
|
quote: Originally posted by micnie_2020 Dear bklr,It's work Fine now.Thank you very much.Cheers,Micheale
Welcome |
 |
|
|
|
|
|
|
|