date data type.

  • Thread starter Thread starter Ran BD
  • Start date Start date
R

Ran BD

Hi guys I have 2 questions.
first I want to update a field containing the year, what is the best data
type for it?
second I want to get the date from a user get time interval parameter (in
months) and calculate the new time. =(curren date)+(monthsdefined) how do I
do that ?
 
Hi Ran,
first I want to update a field containing the year, what is the best data
type for it?

My suggestion is to use tinyint
If the attribute in the relation is a date type you should best use
varchar:

e.g. UPDATE dbo.myTable
SET DateField = CONVERT(varchar(), getdate(), 112)

ISO-Format is useful in case of different date and time
settings at the client pc
second I want to get the date from a user get time interval parameter (in
months) and calculate the new time. =(curren date)+(monthsdefined)
how do I

Take a look in BOL for

DATEADD

HTH ;-)

--
Gruß, Uwe Ricken
MCP for SQL Server 2000 Database Implementation

GNS GmbH, Frankfurt am Main
http://www.gns-online.de
http://www.memberadmin.de
http://www.conferenceadmin.de
____________________________________________________
APP: http://www.AccessProfiPool.de
dbdev: http://www.dbdev.org
FAQ: http://www.donkarl.com/AccessFAQ.htm
 
Back
Top