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
 update to using sql server 2008

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-06-05 : 05:39:23
hi im trying to update columns in my table. i used the update to in sql server 2008
here is my query
UPDATE [EU_PackageDevelopment].[dbo].[SSCUnitholderTable]
SET [SSB_Fund_Num] = 'SSB_Fund_Num, nvarchar(8)',
[Fund_Name] = 'Fund_Name, nvarchar(255)',
[Date_From] = 'Date_From, date',
[Date_To] = 'Date_To, date',
[Basis_Ind] = 'Basis_Ind, nvarchar(8)',
[Share_Class_Name] = 'Share_Class_Name, nvarchar(255)',
[Beg_Bal] = 'Beg_Bal, numeric(31,11)',
[Beg_Bal_Units] = 'Beg_Bal_Units, numeric(22,10)',
[Apps] = 'Apps, numeric(22,10)',
[Apps_Units] = 'Apps_Units, numeric(22,10)',
[Redem] = 'Redem, numeric(22,10)',
[Redem_Units] = 'Redem_Units, numeric(22,10)',
[Dist_Redem] = 'Dist_Redem, numeric(22,10)',
[Dist_Redem_Units] = 'Dist_Redem_Units, numeric(22,10)',
[End] = 'End, numeric(31,11)',
[End_Units] = 'End_Units, numeric(22,10)'
WHERE <'Search Conditions,,'>
GO



what do i put in the where search conditions part to get it to update the columns names in the table.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-05 : 05:42:29
If you want to update columns with same values for all rows, simply you can remove that WHERE Condition

WHERE Condition is for updating specific records based on your business rule

Refer this link to learn about UPDATE Statement
https://www.simple-talk.com/sql/learn-sql-server/update--basics-in-sql-server/
--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-05 : 05:45:46
update the columns names in the table
sounds like what you need is
sp_rename

http://msdn.microsoft.com/en-us/library/ms188351.aspx

make sure you find all reference of the column nad reflect changes once you do the name change otherwise dependent objects like view, procedure etc will break



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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-05 : 05:48:08
you can use sys.sql_modules to find object dependencies for a column. use definition column as shown below

http://visakhm.blogspot.in/2012/03/advantages-of-using-syssqlmodules-view.html

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

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-05 : 05:51:03
quote:
Originally posted by visakh16

update the columns names in the table
sounds like what you need is
sp_rename

http://msdn.microsoft.com/en-us/library/ms188351.aspx

make sure you find all reference of the column nad reflect changes once you do the name change otherwise dependent objects like view, procedure etc will break

Hi Visakh,
I guess he wants to update column values...
By looking at UPDATE posted by OP, he chosen UPDATE statement from SSMS....

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-05 : 05:54:08
quote:
Originally posted by bandi

quote:
Originally posted by visakh16

update the columns names in the table
sounds like what you need is
sp_rename

http://msdn.microsoft.com/en-us/library/ms188351.aspx

make sure you find all reference of the column nad reflect changes once you do the name change otherwise dependent objects like view, procedure etc will break

Hi Visakh,
I guess he wants to update column values...
By looking at UPDATE posted by OP, he chosen UPDATE statement from SSMS....

--
Chandu


Let OP come back with what he wants
It should be either of yours or mine
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -