Click here to Skip to main content
15,899,754 members
Home / Discussions / Database
   

Database

 
QuestionWhats wrong in sql2005 Pin
AlexeiXX323-May-08 20:01
AlexeiXX323-May-08 20:01 
AnswerRe: Whats wrong in sql2005 Pin
Mycroft Holmes25-May-08 0:00
professionalMycroft Holmes25-May-08 0:00 
GeneralRe: Whats wrong in sql2005 Pin
AlexeiXX325-May-08 12:13
AlexeiXX325-May-08 12:13 
GeneralRe: Whats wrong in sql2005 Pin
AlexeiXX326-May-08 8:43
AlexeiXX326-May-08 8:43 
GeneralRe: Whats wrong in sql2005 Pin
Mycroft Holmes26-May-08 12:27
professionalMycroft Holmes26-May-08 12:27 
GeneralRe: Whats wrong in sql2005 Pin
AlexeiXX326-May-08 12:43
AlexeiXX326-May-08 12:43 
GeneralRe: Whats wrong in sql2005 Pin
Mycroft Holmes26-May-08 13:54
professionalMycroft Holmes26-May-08 13:54 
QuestionAny way to attach a timestamp/rowversion column only to selected columns? Pin
supercat923-May-08 14:24
supercat923-May-08 14:24 
I have a database which is used to pass information about certain entities between two programs. Each entity will have a record for each program, containing, in simplified form:

The ID of the entity
The identity (0 or 1) of the program that created the record
Poll Time (used mainly to confirm that both programs are checking the database in timely fashion--not used by the synchronization operations themselves)
Data for the other program
A timestamp/rowversion for that data
A timestamp/rowversion for the other program's data (copied from the other program's record when it's observed)

The first two fields would form a primary key. Each program would check its own timestamp/rowversion against the other programs' to see whether any updates were required.

Two related questions:

-1- What should I use for the timestamp/rowversion? Possibilities I can see:

-a- Using a date/time record for the timestamp would probably work, but it could break if a record gets updated twice quickly. The risk is probably more theoretical than actual, but I'd prefer to avoid something that is structurally not sound.

-b- A 'timestamp' field would seem almost ideal, except that I would want to be able to update the 'other program' timestamp field without bumping my own.

-c- A GUID would work, but GUIDs are bulky and ugly.

-d- In an earlier SQL Server I could have used a bigint and had the update store @@DBTS (a 64-bit integer that was bumped every time a database access occurred). Unfortunately, in newer versions @@DBTS doesn't get bumped unless a row containing a timestamp/rowversion field is updated.

-e- I could have each row contain an ignored timestamp/rowversion field and store @@DBTS in a field I'm actually interested in. That would work, but having the unused field just to force a @@DBTS update seems goofy.

-f- I could use another single-column table as a 'ticket dispenser'. Each time I want a number, do an insert, select SCOPE_IDENTITY(), and empty out the table. That would probably work, but again seems goofy.

What's the right approach?

-2- Is there any good way to find pairs of records, such that the entity ID's are equal, the record types are 0 and 1, and the "My Timestamp" field of the first does not math the "Other Timestamp" field of the second or vice versa, or is the data format described above really not a good design?
QuestionFind Instances Pin
mehrdadc4823-May-08 10:42
mehrdadc4823-May-08 10:42 
AnswerRe: Find Instances Pin
Alsvha23-May-08 21:01
Alsvha23-May-08 21:01 
AnswerRe: Find Instances Pin
mr.mohsen23-May-08 21:22
mr.mohsen23-May-08 21:22 
QuestionUPDATE JOIN problem Pin
Kevin Brydon23-May-08 3:56
Kevin Brydon23-May-08 3:56 
AnswerRe: UPDATE JOIN problem Pin
Ashfield23-May-08 4:01
Ashfield23-May-08 4:01 
GeneralRe: UPDATE JOIN problem Pin
Kevin Brydon23-May-08 4:10
Kevin Brydon23-May-08 4:10 
AnswerRe: UPDATE JOIN problem Pin
Alsvha23-May-08 5:51
Alsvha23-May-08 5:51 
GeneralRe: UPDATE JOIN problem Pin
Kevin Brydon23-May-08 6:19
Kevin Brydon23-May-08 6:19 
Questionupdateing problem Pin
asha_s23-May-08 2:31
asha_s23-May-08 2:31 
AnswerRe: updateing problem Pin
Ashfield23-May-08 3:43
Ashfield23-May-08 3:43 
GeneralRe: updateing problem Pin
asha_s23-May-08 4:17
asha_s23-May-08 4:17 
GeneralRe: updateing problem Pin
Kevin Brydon23-May-08 4:37
Kevin Brydon23-May-08 4:37 
GeneralRe: updateing problem Pin
asha_s23-May-08 4:49
asha_s23-May-08 4:49 
GeneralRe: updateing problem Pin
Ashfield23-May-08 5:43
Ashfield23-May-08 5:43 
GeneralRe: updateing problem Pin
asha_s23-May-08 6:11
asha_s23-May-08 6:11 
GeneralRe: updateing problem Pin
Ashfield26-May-08 6:24
Ashfield26-May-08 6:24 
GeneralRe: updateing problem Pin
asha_s26-May-08 7:21
asha_s26-May-08 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.