Record: A strange problem with SQL Server.

Source: Internet
Author: User

A strange question has come up today. I can't figure out what's going on. Just remember.

1, first there is a table A, containing the field number, date (varchar (250)), the value

The occurrence date field has a non-normal date string, with null, an empty string, which may be a wrong-touch keyboard caused by the input number.

Use a statement query to derive results.

SELECT   FID, FGrossBalanceTime1, Fweightfrom    aWHEREin    (  243423,99188)

2. Prepare to filter out abnormal time data

Added search criteria to filter out null, empty string and non-date format

SELECTFID, FGrossBalanceTime1, Fweight fromaWHERE   1 = 1         andFIDinch(243423,99188)         andFGrossBalanceTime1 is  not NULL         andFGrossBalanceTime1<> "'         and ISDATE(FGROSSBALANCETIME1)= 1

3, take the data within the specified time

SELECTFID, FGrossBalanceTime1, Fweight fromaWHERE   1 = 1         andFIDinch(243423,99188)         andFGrossBalanceTime1 is  not NULL         andFGrossBalanceTime1<> "'         and ISDATE(FGROSSBALANCETIME1)= 1         andFGrossBalanceTime1<= GETDATE()

Black question mark

Subtract 243423 of this data from FID in to perform normal ...

It seems that the IsDate function is the last execution cause of the problem?

Record: A strange problem with SQL Server.

Related Article

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.