Charindex and temporal tables in SQL

Source: Internet
Author: User

Update #temp

Set #temp. Recycle=case when uniona.num>0 then 1 else 0 end

From (select Gradeid,sum (num) as num from Areaallot

where CHARINDEX (@Area, Areaallot.area) =1 and LEN (@Area) =len (area)-2

Group by Gradeid) Uniona INNER JOIN #temp

On uniona.gradeid= #temp. Gradeid

1, for this charindex today tangled a very long time to figure out how to make clear is how a meaning. In order to forget later, so probably make a note.

CHARINDEX (@Area, Areaallot.area) =1 also is the starting position of @area in Areaallot.area, equals 1 means the starting position is first, assuming equals 2 means the starting position is the second position, and so on, but assuming equals 0 means @ Area is not included in the Areaallot.area. The following: Select CHARINDEX (' 43 ', ' 414305 ')
Select CHARINDEX (' 43 ', ' 4305 ') 2, I used to think that group by and order by is a mean, sort. It was only today that group by was used for classification.

Charindex and temporal tables in SQL

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.