Geeks Talk

Prepare for your Next Interview




insert query

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 ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-03-2008
Junior Member
 
Join Date: Jun 2008
Location: Lebanon
Posts: 12
Thanks: 1
Thanked 2 Times in 2 Posts
ronaldrahme is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-03-2008
Junior Member
 
Join Date: Jun 2006
Location: Bangalore
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dipanjan is on a distinguished road
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
Reply With Quote
  #3 (permalink)  
Old 07-03-2008
Junior Member
 
Join Date: Jun 2008
Location: Lebanon
Posts: 12
Thanks: 1
Thanked 2 Times in 2 Posts
ronaldrahme is on a distinguished road
Re: insert query

hey dipanjan,
10x 4 ur help...plz, can u give me an example so it would be more clear?
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 06:12 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved