Monday, March 19, 2012

Force fields upper-case

Almost all of our character fields are stored in upper-case. Is there an easy way to force SQL Server char and varchar fields to upper-case? Something I can do in SQL Server instead of in the client? It needs to apply to any new records.

There are some exceptions (email addresses for one). I don't mind going through each field and changing something.

Thanks!

You could define an INSTEAD OF Insert trigger, and apply the UPPER() function to the columns you want in upper case.|||

Dale,

Is there a way to INSERT INTO <mytable> all fields, but also force the text ones to uppercase? I'm not sure how to do it without listing each field individually.

Brian

|||

I know, tedious.

I thought maybe COLLATE would provide something, but I've not been able to find an answer through that either.

No comments:

Post a Comment