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.
Author |
Topic |
taunt
Posting Yak Master
128 Posts |
Posted - 2014-01-16 : 14:05:38
|
Hello is there a way to make everything in a column uppercase? We have a vendor table and the name field has mix case results. I would like to make it where everything is all uppercase, but had no clue on how to do that in SQL. |
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2014-01-16 : 14:50:57
|
If it is one time run an UPDATE :UPDATE mytable SET ColumnName = UPPER(ColumnName); djj |
|
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2014-01-16 : 16:44:07
|
You can add a trigger than automatically always forces the column to be all upper case.CREATE TRIGGER tablename_trg_name_force_upperON dbo.tablenameAFTER INSERT, UPDATEASSET NOCOUNT ONUPDATE tSET name = UPPER(t.name)FROM dbo.tablename tINNER JOIN inserted i ON i.key_col = t.key_colWHERE NOT EXISTS(SELECT 1 FROM deleted) OR UPDATE(name)GO |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-01-17 : 07:02:13
|
why do you need to do this? So far as your database collation is case insensitive there's no need for this at all!And if its for front end display requirement, there are formatting functions available in all front end languages for doing this.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2014-01-27 : 07:07:48
|
You can make it upper while Selecting data from that table using SELECT statementMadhivananFailing to plan is Planning to fail |
|
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2014-01-27 : 14:37:58
|
Yes. SELECT UPPER(yourcolumn) AS YourColumnName FROM YourTable djj |
|
|
|
|
|