| Author |
Topic |
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2007-07-11 : 01:31:22
|
| hi, i want to update the second row of the c column.can any one help me in this . this is the sample records.a b c 001 test NULL001 test NULL005 test NULL |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-11 : 01:33:31
|
Why second row ? Why not 1st row ? Isn't it both are the same ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2007-07-11 : 01:37:41
|
| 1st r 2nd row |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-11 : 02:22:15
|
| You need unique key to identify the rowMadhivananFailing to plan is Planning to fail |
 |
|
|
noorahmed.shaik
Starting Member
11 Posts |
Posted - 2007-07-11 : 04:54:01
|
u can use cursors to update the record which ever u need...one simple example i am showing heredeclare cur_name cursor scroll dynamic for select * from table_nameopen cur_namefetch absolute 2 from cur_nameudate table_nameset c=somethingwhere current of cur_name Noor AhmedKeysoft solution |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2007-07-11 : 06:57:53
|
| You CAN use a cursor, but dont. Do a forum search and read the 4326546568 hits on why you should not, and on what alternatives you have (A set based solution).[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-11 : 10:20:45
|
| update tset t.c = t.recidfrom (select c, row_number() over (partition by a) as recid) as twhere t.recid > 1Peter LarssonHelsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-12 : 00:41:12
|
quote: Originally posted by Peso update tset t.c = t.recidfrom (select c, row_number() over (partition by a) as recid) as twhere t.recid > 1Peter LarssonHelsingborg, Sweden
Provided the user is using SQL Server 2005 MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-12 : 02:04:03
|
| I assume "New to SQL Server" in the year of 2007 (soon 2008), are using SQL Server 2005 in favor of SQL Server 2000.Peter LarssonHelsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-12 : 05:32:46
|
quote: Originally posted by Peso I assume "New to SQL Server" in the year of 2007 (soon 2008), are using SQL Server 2005 in favor of SQL Server 2000.Peter LarssonHelsingborg, Sweden
Well. Not every company has moved to 2005 MadhivananFailing to plan is Planning to fail |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-12 : 05:35:26
|
Well, Not all my customer is willing to move to 2005 yet  KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-12 : 05:43:08
|
quote: Originally posted by khtan Well, Not all my customer is willing to move to 2005 yet  KH[spoiler]Time is always against us[/spoiler]
Well.That makes more sense MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-12 : 15:06:32
|
| "Not willing to move to SQL Server 2005" implies they are using SQL Server 2000 already, and as such they can't be treated as "new" to SQL Server, right?Peter LarssonHelsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-12 : 23:25:26
|
quote: Originally posted by Peso "Not willing to move to SQL Server 2005" implies they are using SQL Server 2000 already, and as such they can't be treated as "new" to SQL Server, right?Peter LarssonHelsingborg, Sweden
What if new employee who is also new to SQL Server joined in that company? MadhivananFailing to plan is Planning to fail |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-12 : 23:44:11
|
Maybe we should have a separate forum for each version - New to SQL Server 2000- New to SQL Server 2005- New to SQL Server 2008And to make it better. Have one for each of the edition . - New to SQL Server 2005 (Standard & Enterprise & Developer Edition)- New to SQL Server 2005 (Express Edition)- New to SQL Server 2005 (Compact Edition)Maybe at the end newbie will still post to a general "New to SQL Server" forum. "I don't know which version i am using"That will be really messy  KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-13 : 03:32:56
|
Don't forget 32-bit and 64-bit I see your points. Peter LarssonHelsingborg, Sweden |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-07-13 : 08:50:34
|
here's the stock answer to "New to SQL Server 2005 Enterprise":stop now before you hurt someone! elsasoft.org |
 |
|
|
|