Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I Want to copy and data in same Table and Update date Column values? any please help?

share|improve this question
4  
Need more details buddy. Your table structure, what is the UPDATE statement you have tried. The question is too vague to expect any useful responses –  Raj May 8 '13 at 4:45
add comment

closed as not a real question by Mat, Paul White, ypercube, Mark Storey-Smith, dezso May 8 '13 at 9:20

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

It's difficult to understand your question. Do you mean that you want to copy the data in a table into new rows, but update DATE values?

For example, is the following what you're trying to do?

ORIGINAL TABLE_1:
TABLE_ID | VALUE_1    | VALUE_2         | DATEFIELD
1        | 'Somedata' | 'Someotherdata' | 2012-05-01 ...

And you want to produce:

UPDATED TABLE_1:
TABLE_ID | VALUE_1    | VALUE_2         | DATEFIELD
1        | 'Somedata' | 'Someotherdata' | 2012-01-01 08:59...
2        | 'Somedata' | 'Someotherdata' | 2013-05-08 09:00...

For instance?

In that case, you can just run a regular insert, using the source data as the source for the insert. Copying all other values directly save for DATEFIELD where you just manually use whatever value you want.

To create the scenario above in the code segments, you can for instance use this script (you have to come up with the filters for which range of data you want, since we don't know):

INSERT INTO TABLE_1 (VALUE_1, VALUE_2, DATEFIELD)
SELECT VALUE_1, VALUE_2, GETDATE() 
FROM TABLE_1

But as Raj said, you need to open up your question more. At this point it's not even logically clear what you're even asking for, let alone the technical specs for what you want.

share|improve this answer
    
Yes I Want to copy data in same Table? –  Muhammad Raza Saleem May 14 '13 at 4:19
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.