Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

can I easily replace a default value throughout my database?

$
0
0

I have SQL Server management studio express, which I use to manage a database for my website, which is hosted on a shared server in cyberspace. 

I have been using 'getdate()' as a default in many of my tables, for a field that I name "dateEntered".  So when records are added to these tables, the date and time that they were added is inserted as well.

Now I want to place all the getdate()'s by getutcdate().

That way, no matter what time zone the server database is hosted at, I can base my date calculations on a standard time zone.

The database is full of test data now, but not real data.

So I could delete the database, after scripting the whole database to a sql file, and doing a find/replace of getdate/getutcdate and then executing the script to create the database.

However, perhaps there is a stored procedure I could write that would allow me not to lose all my test data, and yet accomplish the same thing.  

Is that feasible?

Thanks.


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>