Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Search & Update a record with in the table

Author  Topic 

tahseenm
Yak Posting Veteran

64 Posts

Posted - 2013-01-24 : 10:08:02
How to do a quick search on a particular record with in a table. Let me know the details or the script to get to the record you are looking for out of 29,000 records I would like to go to this particular record in a table to change few things.

Table name is billing.acct and the fields names i am looking is as follows:

accountnumber,finalbillflag,credflag

Thanks and appreciate your quick response.

moetahsen

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-24 : 12:47:19
Something like shown below
-- see if the record exists in the table.
select * from billing.acct
where accountnumber = '1234' and finalbillflag = 'F' and credflag = 'N';

-- update columns in the record.
update billing.acct set
closeoutdate = '20121231',
closedby = 'tahseenm'
where accountnumber = '1234' and finalbillflag = 'F' and credflag = 'N';
Go to Top of Page

tahseenm
Yak Posting Veteran

64 Posts

Posted - 2013-01-24 : 15:02:45
So I use the second script to update or some changes on it. Let me know.

I need to update the record that has the accountnumber=56073-06, finalbilling=Y, credflag=Y.

Currently the record has finalbilling=N,credflag=N

Let me know. Thanks

moetahsen
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-25 : 01:32:48
quote:
Originally posted by tahseenm

So I use the second script to update or some changes on it. Let me know.

I need to update the record that has the accountnumber=56073-06, finalbilling=Y, credflag=Y.

Currently the record has finalbilling=N,credflag=N

Let me know. Thanks

moetahsen


try it first on test table
it should give you what you've asked for
once happy do it on actual table



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -