Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with script to merge two statements

Status
Not open for further replies.

fabien

Technical User
Sep 25, 2001
299
AU
Hi!

I have the following statement:
update grid_hdr set datum = XX where grid_id = XX;

I get grid_id by doing:
select grid_id from grid_hdr where (map_data_set_name = 'blbla' and geo_name = 'blibli')

Could someone please help me:

1) merge those two statements into one
2) make a script that will ask map_data_set_name, geo_name and datum and then search the grid_id to make the update statement.

Thanks a lot!
 
Code:
UPDATE grid_hdr
SET datum = XX
WHERE map_data_set_name = 'blbla'
  AND geo_name = 'blibli'

--James
 
Thanks I should have thought of that!

And how can I make it a general script asking for blbla and blibli?

Thanks again!
 
Use a stored proc:

Code:
CREATE PROC myproc
  @datum datetime,
  @map varchar(20),
  @geo varchar(20)
AS

UPDATE grid_hdr
SET datum = @datum
WHERE map_data_set_name = @map
  AND geo_name = @geo
GO

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top