Prepare for your Next Interview
This is a discussion on insert query within the SQL forums, part of the Databases category; goodmorning, let us assume i have a table called dbo.Info with some data, for example: ClientID Name 111 Phil 112 Steve 113 Victor 114 Ralph . . . . . . okay, now i wanna ...
|
|||
|
insert query
goodmorning,
let us assume i have a table called dbo.Info with some data, for example: ClientID Name 111 Phil 112 Steve 113 Victor 114 Ralph . . . . . . okay, now i wanna add a new column to the table, suppose alter Table dbo.Info alter column Age int go so my question is i wanna make an insert script which insert data in Age for each Row sth like that; Insert into dbo.info (Age) values ('25') where name = 'steve' so i wanna insert each row by itself, how can i correct this script?? 10x in advance |
| Sponsored Links |
|
|||
|
Re: insert query
well as you can see u have to actually parse through each row to get the names
and also provide the script with correct age therefore use a cursor to pick the name and put an insert inside the cursor for that name insert into dbo.info (Age) where name = @valuegivenbythecursor |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Insert in a table | raj_imr2000 | SQL | 2 | 02-12-2008 09:15 AM |
| How to insert values | RupeshDharne | Oracle | 4 | 12-10-2007 08:06 AM |
| Insert when, Insert all when difference | krishnaindia2007 | Oracle | 1 | 12-04-2007 02:10 AM |
| Insert Script | krishnaindia2007 | Oracle | 4 | 11-21-2007 04:05 AM |
| Insert of multiple records in single query | ramvidhu | SQL Server | 5 | 07-03-2007 08:53 AM |