简体   繁体   中英

SQL Server Report Builder : Concatenate data type “date” and “time”

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM