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
 General SQL Server Forums
 New to SQL Server Programming
 sql update question

Author  Topic 

sanamfrens
Starting Member

2 Posts

Posted - 2013-10-09 : 17:59:12
I need an update script for the following problem in sql server environment . Could anyone please help….
When ‘mobile phone’ exists, change to ‘home’. When ‘mobile phone’ does not exists then change to ‘mobile phone’

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-10-09 : 18:19:07
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-10 : 01:23:14
which table? which column? without all these information how can you expect someone to help?

Post some sample data and show how you want output to come.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

sanamfrens
Starting Member

2 Posts

Posted - 2013-10-10 : 11:59:58
sorry visakh, I am new to sql so did not know what I need to provide as a source. please find the table name and column name:
In phone Address table there is one phone_type column exists there.
In phone_type column there are different types of phone records are there eg: mobile, home, fax, business, temporary
Now,
in phone_type column,
When ‘mobile phone’ exists, change to ‘home’. When ‘mobile phone’ does not exists then change to ‘mobile phone’
other type should be as it is.
Thank you in advance.
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs

[/quote]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-10 : 14:17:09
so are you telling at the end of change you'll just have only two types? home and mobilephone?

Please help us to help you by giving some sample data in below format

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -