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
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Hey.. Two issues at hand.

Author  Topic 

Johnny1985
Starting Member

26 Posts

Posted - 2008-05-15 : 14:28:14
Hello !

I came across some interesting issues that solving them will definately help me a lot !

1) Is there a way to insert my database a row, and that it will automatically fill up the datetime column with the local machine time ? (so that I won't have to worry about users local time)

2) I'm trying to synchronize between two data sources - one is my DB and the other is a file. The data in the file should represent the data to be in the DB. However, I don't want to delete all the records and then just insert everything in the file, but to perform Insert, Update or Delete operations according to the file's changes. I managed to do the Insert and Update, but I can't find a solution to a scenario where old data, which is on the DB but not on the file, could be deleted from the DB.

I appreciate the help A LOT !

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-15 : 15:12:52
1. Yes, add a default constraint to the column with a value of GETDATE() or GETUTCDATE(). If supporting multiple time zones, then you should use GMT.
2. You should import your data into staging tables and then use T-SQL to figure out what to modify.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

Johnny1985
Starting Member

26 Posts

Posted - 2008-05-16 : 19:51:20
Thanks for the tips !
The first answer helped me, but I used some coding logic to solve the second one.

I have another question though.
Say I want my table to grow up in records until reaching a certain maximum rows number, and then just clear everything and start filling it up again.

Is there a way doing that in table configuration rather checking it each time programatically ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-18 : 18:39:06
There is no such table config. You will need to check this manually.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page
   

- Advertisement -