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.
Author |
Topic |
harrisw48
Starting Member
34 Posts |
Posted - 2006-11-07 : 09:25:52
|
I have a DTS in SQL 2k that basically copies fields to a destination location when ran.What I want to do is force current date into a field on the destination fileHow can I do it?Thanks |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-11-07 : 09:29:13
|
Using a default on the column?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
harrisw48
Starting Member
34 Posts |
Posted - 2006-11-07 : 15:54:25
|
What do you mean use a default?Can you explain further, and how to do it |
 |
|
Antonio
Posting Yak Master
168 Posts |
Posted - 2006-11-10 : 06:14:49
|
quote: Originally posted by harrisw48 What do you mean use a default?Can you explain further, and how to do it
Hi mate,look up CREATE TABLE in BOL,Here is an extract straight from the help :DEFAULTSpecifies the value provided for the column when a value is not explicitly supplied during an insert. DEFAULT definitions can be applied to any columns except those defined as timestamp, or those with the IDENTITY property. DEFAULT definitions are removed when the table is dropped. Only a constant value, such as a character string; a system function, such as SYSTEM_USER(); or NULL can be used as a default. To maintain compatibility with earlier versions of SQL Server, a constraint name can be assigned to a DEFAULT.Here is a very simple example :create table #test (someColumn varchar(5), myDefaultDate datetime default getdate(), myDefaultInteger int default 2)insert into #test (someColumn) values ('Hello')select * from #testdrop #test _________________________________________________________________________________________________________________________Inability is a disaster; patience is bravery; abstinence is a treasure, self-restraint is a shield; and the best companion is submission to Divine Will. |
 |
|
|
|
|