In which format I should pass date field to parameter to be able to choose date picker insted of list?
My query returns date (date format) and I cast it in a different ways (yyyy-dd-MM, yyyy-MM-dd, dd-MM-yyyy, ...) in SSRS:
=Format(Fields!StartDate2.Value,"yyyy-dd-MM")
I use this field in parameter, but I always get error:
An error has occurred during report processing. (rsProcessingAborted)
The property ‘ValidValues’ of report parameter ‘STARTDATE’ doesn't
have the expected type. (rsParameterPropertyTypeMismatch)
When I just passing result of query (date format), I have list:
even If chose Date/Time:
Answer
The reason you are getting this problem is because the Language/Culture/Date Format on your environments are not similar.
SQL by DEFAULT uses en-US and your local pc uses your local Language/Culture/Date Format.
there is your problem, instead of converting the value of your dates to your local
Language/Culture/Date Format, convert it to en-US
"MM-dd-yyyy"
Answer explained
to put this in perspective you are sending a SQL server with the date format
"MM/dd/yyyy" the value "2017/16/03".
so the server thinks "this guy is telling me to search for the 2017th month, 16th day of the year 03"
Related
My date is stored in a type date column in dd/mm/yyyy format. I want to print the date in yyyymmdd format.
When i used the following formula
tonumber(totext(db.colname,'YYYYMMDD'))
It gave me a "the string is non numeric" error when previewing the report.
Secondly,
My time is stored in a string column in 12 hour format. I want to display it as hh24miss format.
How do i do that ?
First of all, you should NOT store dates/times as text in your database.
Use the apropriate datatype of your DBMS.
Otherwise you will very likely have further problems because of this.
When you've changed the datatype you could just drag&drop the database-field inside your report and use the formatting options of Crystal Reports to get the desired format.
If for any reason (I doubt there's a good one) you can't change the datatype, use the following formula.
ToText(Date({db.colname}), "yyyyMMdd")
This formula converts the string to a date and then formats the date with yyyyMMdd format.
Notice the uppercase M which is used for the month. Lowercase m is used for minutes.
I am trying to load some data from a .csv file into my SQL Server. There is a column for date which has datatype Unicode (WSTR) in the .csv file and the column for storing that date in SQL Server is of Datetime data type.
When I used DATA CONVERSION transformation to convert WSTR data to DBTIMESTAMP data, it got changed but with an error that it interchanged the month and date which gives me the wrong date.
The date should be like 2019-09-03 (for 3rd Sep 2019), but I get 2019-03-09.
Please suggest what the issue is that I am facing?
Problem
This may occurs when converting a string to a date value without specifying the date format. Reffering to the SSIS data conversion transformation official documentation:
If you are converting data to a date or a datetime data type, the date in the output column is in the ISO format, although the locale preference may specify a different format.
Assume that the data is stored in the csv file with the following date format MM/dd/yyyy and the default date format in the regional settings is dd/MM/yyyy then date values will not be converted properly.
Solution
In order to specify the date format you have to use a Script Component or a Derived column.
Derived Column
You have to reorder the date part manually, you can use TOKEN() and TOKENCOUNT() function to do that, the following expression convert dd/MM/yyyy format into yyyy-MM-dd universal format:
TOKEN([DateColumn],"/",3) + "-" + RIGHT("0" + TOKEN([DateColumn],"/",2),2) + "-" +RIGHT("0" + TOKEN([DateColumn],"/",1),2)
Script Component
You can use DateTime.ParseExact() function to parse a date based on a specific format:
DateTime.ParseExact(Row.DateColumn,"MM/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture");
I have an issue with SSRS where when posting in a DD/MM/YY value via URL string into a Parameter it decides to read the Day value as the Year, the Month as month, but the Year goes into Day value, for example:
I am inputting the date of 30/08/17 via an ERP System which then generates a string to be used as an URL to generate the report, this date value should then go into a parameter called fiAsOfDate which is Date/Time data type, but at this point it is reading the value as 08/17/1930 inside the Parameter list, even though the URL remains at 30/08/17.
This happens prior to the Query being processed, and the fiAsOfDate parameter then gets formatted through to to MMDDYYYY to be processed within the Query, but the issue is specifically when the parameter is having the value loaded from the URL into the parameter value, and I was hoping if anyone could assist me on this please?
I should also add, this original date is coming from an ERP system which will have regional based date formatting, as it is used internationally, so I cannot restrict myself to one input format, and it should be using regional settings, matching that of the Reporting server that it is based on.
Kind Regards,
James W. Acklam.
To avoid regional setting issues you can change the date into a known integer or string format: I use CONVERT(NVARCHAR, YourDate, 112) to get a string '20170830'. The regional settings won't recognize that as a date and so won't auto-parse it into MM/DD/YYYY or DD/MM/YYYY. Of course, you'll need to parse that yourself so you can use it in the report, but at least you know the format.
This issue was down to my own misunderstanding that the DataSource I was pulling data from worked only in DMY format. Converting dates from parameters format to DMY format and processing that through the DataSet's query resolved the issue.
I am working with SQL Server Report Builder 2008 R2.
I have a dataset that contains DateEntry (date, null) and TimeStampAuto (time(7), null) columns. I am trying to write an expression for concatenating those two values, so I can put it under DATETIME column on the report table. I tried the following but it does not work. It displays "#Error."
=First(Fields!DateEntry.Value, "Report1) & " " & First(Fields!TimeStampAuto.Value, "Report1)
When I just put the first part of the expression shown above, the report displays the date with some random time value (5/1/2015 12:00:00 AM). However, I did not put any time value in DateEntry. I only put the dates.
When I put the second part of the expression shown above, the report displays correct time that the data has.
I don't know why I can not concatenate those two.
The system type of the DateEntry.Value will be a DateTime value which is the readon that your report is showing 5/1/2015 12:00 AM even though it is only a date field in the database.
You need to format the date to only include the day,month and year to remove the included default time of 12:00 am
you will probably need to check for null values in both your date and time fields. you will also need to format the time filed to exclude any default date information.
I am firing a insert query in 'dd/mm/yyyy' format but it is storing date into MM/DD/YYYY format.
I just want to know why it is happening?
This is insert query i am using.
insert into txnblackout(endtime,idtxn,blackoutflag,starttime,startdate,typeuser,id_entity,idsequence,idapp,enddate)
values('83520','LGN','D','7920',TO_DATE('30/12/2012','dd/mm/yyyy'),'ECU','B001','4','A1',TO_DATE('30/12/2012','dd/mm/yyyy'))
If you don't want to change the Windows date format (as suggested by Colin 't Hart), you can
use an explicit to_char() date format in your query (as suggested by Robert Hanson)
set your client NLS settings
configure your client (since you seem to be using PL/SQL developer):
Tools -> Preferences -> NLS options -> Date -> check user defined + enter your format
Personally, I'd set the client NLS settings.
This is a front-end issue: it's displaying the dates in that format. Because they are date fields, the dates really do represent the dates that you inserted.
I note in the bottom right hand corner of your screenshot that the date there is displayed in MM/DD/YYYY order. Change this setting in Windows and it will more than likely display correctly in your front-end tool.
The important bit can be gleamed by your insert, which includes "TO_DATE('30/12/2012','dd/mm/yyyy')". This is converting the string '30/12/2012' to an internal date object format that is specific to the DB. You can't control the underlying storage format. What you can control however is how that internal date object is converted back to a string by using date formatting functions when you call select.
select to_char(some_date, 'dd/mm/yyyy') my_date from some_table;
In the visual interface you referenced it is simply showing the default date to string conversion.