Date type data in database import to report remove 00:00__ database

Source: Internet
Author: User

Problem:

Date in the SQL Server database is the type of dates, that is, month-day form yyyy year MM DD day, but imported into the report into the yyyy year mm month DD Day 00:00, that is, more than 00:00

How to remove the 00:00 ...


query table settings as shown in figure: Note that date is of type date date type



The original query statement I had in the database was written like this:

Select *from checkday_info where date= @CheckDate

The result: more than 00:00


"Fa Yi"

After Baidu changed to: (Use the time to cast)

Select Remaincash,rechargecash,consumecash,cancelcash,allcash,convert (varchar), date,23) as date from Checkday_ Info where date= @CheckDate


The following is an explanation of the red font:

First parameter varchar (10): is the second parameter date to be converted to the data type

Second parameter date: The field name of the date type to convert

The third parameter 23:date the format displayed after conversion, 23 is YYYY-MM-DD format, and 10 is mm-dd-yy format

23 is just one of the conversion formats, and different numbers represent different formats.


"Law II"

Use the Mid function to intercept

Mid is a string function in Visual Basic and Microsoft Excel that intercepts a specified number of characters from a string

The mid function is defined in detail as follows:
Mid (Text,start_num,num_chars)
Parameters:
Text: A string expression from which to return a character. If text contains null, NULL is returned.
The start position of the character part that is extracted in the start_num:text. If start exceeds the number of characters in text, MID returns 0 length
Num_chars: The number of characters to return. If you omit or num_chars more than the number of characters in the text (including the character at start), all characters from the start_num to the end of the string are returned.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.