Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > how to copy from fields to other fields

Reply
Thread Tools

how to copy from fields to other fields

 
 
middletree
Guest
Posts: n/a
 
      11-05-2003
I have a table which has a datetime field for when a row in this one table
(Ticket) was created. This is for trouble tickets for a help desk. After a
ticket has been created, any additions to that ticket are recorded in
another table called History. There could be several additions, thus the
splitting up into a one-to-many relationship.


In order to meet the boss's request, I recently added a LastModified field
to the Ticket table. I have included code in my ASP which will fill that
field with the date when a new ticket is created, and then when new data is
added later, will update that field. The problem is that for all existing
tickets, that field is empty. I'd like to run a SQL statement which will
copy the entry date (but only the date, not the time) from the original
timestamp field of each existing ticket, and then go back and see if there
are any updates in the History table for each ticket, and if so, take the
MAX value for the Timestamp field in that table, and copy it over, again,
just the date, not the whole timestamp.

I realize that you may wonder why I don't just use the MAX(TimeStamp) from
my history table as my lastmodified, but I had lots of trouble with this.
This way works, and I just need to find a way to keep from having nulls in
existing tickets.


 
Reply With Quote
 
 
 
 
middletree
Guest
Posts: n/a
 
      11-05-2003
Should add I'm using SQL Server 2000.


"middletree" <> wrote in message
news:...
> I have a table which has a datetime field for when a row in this one table
> (Ticket) was created. This is for trouble tickets for a help desk. After a
> ticket has been created, any additions to that ticket are recorded in
> another table called History. There could be several additions, thus the
> splitting up into a one-to-many relationship.
>
>
> In order to meet the boss's request, I recently added a LastModified field
> to the Ticket table. I have included code in my ASP which will fill that
> field with the date when a new ticket is created, and then when new data

is
> added later, will update that field. The problem is that for all existing
> tickets, that field is empty. I'd like to run a SQL statement which will
> copy the entry date (but only the date, not the time) from the original
> timestamp field of each existing ticket, and then go back and see if there
> are any updates in the History table for each ticket, and if so, take the
> MAX value for the Timestamp field in that table, and copy it over, again,
> just the date, not the whole timestamp.
>
> I realize that you may wonder why I don't just use the MAX(TimeStamp) from
> my history table as my lastmodified, but I had lots of trouble with this.
> This way works, and I just need to find a way to keep from having nulls in
> existing tickets.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
epydoc: How to add new fields as the building fields? Cyril.Liu Python 0 12-02-2008 05:01 AM
print struct fields and its member structs' fields recursively, generically call_me_anything C++ 4 09-30-2007 10:12 PM
what is Deep Copy, shallow copy and bitwises copy.? saxenavaibhav17@gmail.com C++ 26 09-01-2006 09:37 PM
is dict.copy() a deep copy or a shallow copy Alex Python 2 09-05-2005 07:01 AM



Advertisments