date data type.

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 ?
 
U

Uwe Ricken

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top