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 |
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-24 : 13:00:00
|
| Hey , I have a fild in a table which stores date but the datatype is decimal (8,0)the problem i have is i have to write a store procedure where i need to declare a variable eg. @Startdate ; @EndDateThis stor proc is created for Crystal report . So when the user types in it has to be mm/dd/yyyy.could someone help me out pleasethank you,Mattie |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-02-24 : 13:33:28
|
| Well you'll need to convert the parameters to your date format. If you could provide some examples of your date format, then we should be able to help you out.And have you thought about fixing the data type in the table as datetime data should have a data type of datetime?Tara |
 |
|
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-24 : 13:59:17
|
| Hey, Yes we are thinking about it. the date format i need it in is mm/dd/yyyyright now the data is stored in this format 20050224 |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-02-24 : 14:05:33
|
| Here you go, converted from datetime to varchar then to decimal:DECLARE @StartDate datetime, @EndDate datetimeSELECT @StartDate = '02/24/2005', @EndDate = '12/31/2005'SELECT CONVERT(decimal(8), CONVERT(varchar(8), @StartDate, 112))SELECT CONVERT(decimal(8), CONVERT(varchar(8), @EndDate, 112))Tara |
 |
|
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-24 : 14:16:33
|
| Thank u soooo much |
 |
|
|
|
|
|
|
|