[dba-SQLServer]A real Newbie Queston re:updating a Field in a Table

Nicholson, Karen knicholson at gpsx.net
Wed Oct 29 14:00:26 CST 2003


This would be in a stored procedure.  
Create a new stored procedure such as:

create stored procedure gps_update as
update dbo.prospect
set dbo.prospect.udf12='myvalue'
FROM  dbo.prospect INNER JOIN
      dbo.customer ON dbo.prospect.cust_no = dbo.customer.cust_no

Then, from SQL server, go up to TOOLS.
Selected SQL query analyzer.

A new window opens.  Make sure that you select the correct database from the
drop down box.
Type:
exec gps_update

Then hit the green arrow to run the procedure.

Your stored procedure will run.

-----Original Message-----
From: Klos, Susan [mailto:Susan.Klos at fldoe.org]
Sent: Wednesday, October 29, 2003 2:52 PM
To: 'dba-sqlserver at databaseadvisors.com'
Subject: RE: [dba-SQLServer]A real Newbie Queston re:updating a Field in
a Table


This is really going to show my ignorance.  Do you put the sql code in a new
view?  If not, where?

-----Original Message-----
From: Nicholson, Karen [mailto:knicholson at gpsx.net]
Sent: Wednesday, October 29, 2003 10:39 AM
To: dba-sqlserver at databaseadvisors.com
Subject: RE: [dba-SQLServer]A real Newbie Queston re:updating a Field in
a Table


Here is an example - I have a prospect and a customer table.  Join them by
their common field, cust_no.
Update the field you want to update (I used udf12) to the desired value.


update dbo.prospect
set dbo.prospect.udf12='myvalue'
FROM  dbo.prospect INNER JOIN
      dbo.customer ON dbo.prospect.cust_no = dbo.customer.cust_no

-----Original Message-----
From: Klos, Susan [mailto:Susan.Klos at fldoe.org]
Sent: Wednesday, October 29, 2003 10:13 AM
To: 'dba-SQLServer at databaseadvisors.com'
Subject: [dba-SQLServer]A real Newbie Queston re:updating a Field in a
Table


I have two tables which are inner joined on two fields.  One of the tables
contains a flag field.  I want to update the flag field only where records
in the two tables are the same.
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


More information about the dba-SQLServer mailing list