2012年3月21日星期三

Flags on a table

Hi all

Been thrown a bit in the deep end and need some advice..... new to db design.

I have been emailed the lay out of the table which is not a problem, they then go on to talk about flags on columns if data is inserted , updated... ect.

How do i set them up ?

The data is going to be imported in via DTS from a excel spread sheet

Thanks in advance

Rich

No clue. Can you post the exact request (without any kind of private information of course :) If they wanted the date and time of updates and inserts, that would be easy enough, but a flag (generally thought of as a imitation boolean (often using a bit) that is set to TRUE/ON when some condition is met (like disabledFlag might indicate that an account was disabled.)

This wouldn't make sense to have an updatedFlag, since it could be updated many times.

|||

Could it be that they are talking about triggers.

In a trigger you can do things like:

If UPDATE(column name)

BEGIN

END

|||

Thanks for the responses, I now have more details and I don't explain the problem properly.

What is happening is the I will have to import data via DTS each night which will be located as a file on a FTP server, so for example the customer table has a change i.e update or insert, the documentation talks about flags so that it can do the necessary change or ignore the row and move to the next one.

Does this make more sense?

Rich

|||

Do you mean that the flags should function as some kind of indicators whether a certain row should be updated or not..?

(still a bit confused about what those flags are supposed to do..)

/Kenneth

|||

Richie_C wrote:

What is happening is the I will have to import data via DTS each night which will be located as a file on a FTP server, so for example the customer table has a change i.e update or insert, the documentation talks about flags so that it can do the necessary change or ignore the row and move to the next one.

Does this make more sense?

Getting there. What I am starting to think is that they want you to put flags on rows so you can see if the row has been changed since some last export perhaps? This can be done with triggers:

--untested
create trigger tableName$update
on tableName
after update
as

begin

update tableName
set updateFlag = 1
from tableName
join inserted
on tableName.key = inserted.key

end

|||

gents

thanks for all you responses, the flags are going to be programmed in xml for checking.

sorry for wasting everybodys time!!

|||

No time wasted here. I am just interested in how you are using XML? How did this come about? Can you explain?

没有评论:

发表评论