Current date without current time

Current date without current time

Post by Willem Spaan » Wed, 22 Jan 1997 04:00:00



Hi,

I have some difficulties using datetime columns, probably I just don't
understand it.

Suppose I have a table with 2 columns: a date and an integer. The only
thing I want to do is insert a row every day with values current date and
1, and update a row by adding 1 to the integer column.

My problem is that I don't know how to insert just the current date in the
column. Even when using the smalldatetime data type SQL Server inserts the
time that the record was created, and not just the date. When, later that
day, I want to update that record, I can't find it. I want to do something
like

INSERT INTO Table VALUES ( currentdate, 0 )     and
UPDATE Table Set integervalue = integervalue + 1 WHERE date = currentdate

Can someone help me, please???

Hugo.

 
 
 

Current date without current time

Post by Roy Harv » Wed, 22 Jan 1997 04:00:00


Hugo,

What you want to do is convert the datettime to a character string
without the time, then convert it back to datetime.  For example:

SELECT CONVERT(datetime, CONVERT(char(10), getdate(), 101))

This will leave the time set at midnight.

Roy


>Hi,
>I have some difficulties using datetime columns, probably I just don't
>understand it.
>Suppose I have a table with 2 columns: a date and an integer. The only
>thing I want to do is insert a row every day with values current date and
>1, and update a row by adding 1 to the integer column.
>My problem is that I don't know how to insert just the current date in the
>column. Even when using the smalldatetime data type SQL Server inserts the
>time that the record was created, and not just the date. When, later that
>day, I want to update that record, I can't find it. I want to do something
>like
>INSERT INTO Table VALUES ( currentdate, 0 )     and
>UPDATE Table Set integervalue = integervalue + 1 WHERE date = currentdate
>Can someone help me, please???
>Hugo.


 
 
 

Current date without current time

Post by Trevor Dwye » Wed, 22 Jan 1997 04:00:00


Hi William,

Look on David Solomns' web page http://www.metis.com/weeklytips.htm
and you will find a tip on datetime functions. This will provide you with a
good
overview/solution for your problem.

Best Regards
Trevor Dwyer





Quote:> Hi,

> I have some difficulties using datetime columns, probably I just don't
> understand it.

> Suppose I have a table with 2 columns: a date and an integer. The only
> thing I want to do is insert a row every day with values current date and
> 1, and update a row by adding 1 to the integer column.

> My problem is that I don't know how to insert just the current date in
the
> column. Even when using the smalldatetime data type SQL Server inserts
the
> time that the record was created, and not just the date. When, later that
> day, I want to update that record, I can't find it. I want to do
something
> like

> INSERT INTO Table VALUES ( currentdate, 0 )     and
> UPDATE Table Set integervalue = integervalue + 1 WHERE date = currentdate

> Can someone help me, please???

> Hugo.

 
 
 

Current date without current time

Post by Michael Yocc » Thu, 23 Jan 1997 04:00:00


select convert(char(8), getdate(), 1)

--------
01/22/97

(1 row(s) affected)

--
Michael Yocca Database Analyst PPG Industries, Inc., Pittsburgh, PA

President PGH SQL Server Users Group
http://users.sgi.net/~myocca/sql/pghssug
Why is it that they call the place you drive your car a parkway but, they
call the place that you park cars a driveway?
disclaimer "The opinions expressed are those of the writer and not of PPG
Industries, Inc. nor any PPG-associated company."



Quote:> Hi,

> I have some difficulties using datetime columns, probably I just don't
> understand it.

> Suppose I have a table with 2 columns: a date and an integer. The only
> thing I want to do is insert a row every day with values current date and
> 1, and update a row by adding 1 to the integer column.

> My problem is that I don't know how to insert just the current date in
the
> column. Even when using the smalldatetime data type SQL Server inserts
the
> time that the record was created, and not just the date. When, later that
> day, I want to update that record, I can't find it. I want to do
something
> like

> INSERT INTO Table VALUES ( currentdate, 0 )     and
> UPDATE Table Set integervalue = integervalue + 1 WHERE date = currentdate

> Can someone help me, please???
> Hugo.

 
 
 

1. ((Current Date - Start Date)/(End Date - Start Date))*Contract Amt

We have a cube consisting of a fact table with a measure of Contract Amt ($)
plus some other accounting numbers related to projects and a couple of
dimensions (actually more but that should be enough information for this
question) - Time and Projects with a project number as a key.

We are trying to create the following calculated member:

((Current Date - Start Date)/(End Date - Start Date))*Contract Amt

Where

  a.. Current Date is a member of Time dimension (either default or
explicitly created)
  b.. Start and End Dates are properties of a project number (should they be
defined as custom properties or some other way?)

What is the correct syntax for this calculation?

Can it be a member of measures dimension?

Thanks much for any helpJ

Alex Pitko

2. Stupid question about

3. Current date and time as the Default Value for a DateTime Field

4. My Finger hurts. LinkedServer myExcel.xls

5. How to assign Current Date and Time?

6. ADO and Access - Nagging problems - HELP!

7. How to record the current date time?

8. Default Printer

9. Retrieving the current date/time from the server.

10. Current Date and Time

11. Question about Get Server Current Date and time, thank you

12. Getting current date & time

13. Current date and time