Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date time datatype stored procedure

Status
Not open for further replies.

Jyme

MIS
Apr 28, 2004
29
US
I have a report running off of a stored procedure in sql server. One of the parameters is datetime. In the report it wants the parameter to be date time and I just want it to select the date. It wont let me change it to just date, how can I accomplish this?

thanks
 
SQL Server doesn't have a data type of DATE, hence you can't change it.

You might set the prompting text in CR to tell users ignore the time portion, and then in the SP set the time portion to the appropriate value.

-k
 
If you are not able to edit the sp, would it not work to set the parameters in cr to date and then in selection formula or command, tack on the time?

ex:
where datefield in datetime({@dateprm1},time(00:00:00)) to datetime({@dateprm2},time(23:59:59))



 
Haveyou considered useing the CAST in the SP to turn the datetime into a char field, and then basing the parameter from that? I work with a VFP database, and have sucessfully done it quite a few times to remove the time from the datetime field.

Bob
Robert Pevey and Associates

 
Bob: The nuisance there is that then the prompt wouldn't be a date type and you wouldn't get the date control nor bad data checking.

It's much easier to just strip the time portion out in the SP and retain the date formatting.

I believe that VFP has both a DATE and DATETIME data type, so this shouldn't be an issue for you since you can simply expose any parameters as type date.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top