Sqlsever base Convert sorts a column of type character into an int type

Source: Internet
Author: User
Tags sorts

Town Field Poem:
——— Dream who feel, the water month Build blog. Baiqian tribulation, only know the vicissitudes of the world.
——— today holds the Buddhist language, the technology is boundless willing to learn. Willing to do what you learn, cast a conscience blog.
——————————————————————————————————————————

1 Base Code

1  UseMaster2 Drop DatabaseHelloWorld3 4 --Create a database5 Create DatabaseHelloWorld6 7 --use helloworld1 this database8  UseHelloWorld9 Ten --Create a table teacher One Create TableTeacher A ( -Idint Primary Key Identity(1,1),    -Namenvarchar(Ten), theClassnchar(2), -Scorevarchar(5) - ) -  + Create Table Location - ( +Classnchar(2), ALocationnvarchar(5) at ) -  - --look at teacher, what's this form? - Select *  fromTeacher - Select *  from Location -  in --insert these lines of content into this teacher, which I insert once, simply modify, and insert again - Insert  intoTeacher to        Values('burning lamp Ancient Buddha','Buddhist',' -'), +('Buddha Buddha','Buddhist',' -'), -('Maitreya Buddha','Buddhist',' -'), the('Buddha Buddha','Buddhist',' -'), *('nu wa Niang','Taoism',' +'), $('Buddhist Bodhisattva','Buddhist','103'),Panax Notoginseng('The Buddha','Buddhist','102') -  the --insert these lines into this location + Insert  into Location A         Values('Buddhist','India'), the('Taoism','China'), +('Christ','Western'), -('Confucian','China')

2 Show Code

1 -- see what's in the teacher table 2 Select *  from Teacher

3 Show

4 varchar Order Code

1 -- The original varchar type, can also be sorted, 1000 this number is really carefully designed, hehe 2 -- varchar types can also be arranged, but the rules are different, the strings are arranged first in front, the same big, who long who in front 3 Select *  from Teacher 4 Order  by desc

5 varchar Order Show

6 Key Code

1 -- the key code 2 Select *  from Teacher 3 Order  by Convert (intdesc

7 Key Show

——————————————————————————————————————————
The essence of the blog, in the technical part, more in the town yard a poem.
Sqlsever is a good language, worth studying hard. Familiar with the database of additions and deletions, write procedures necessary.
If the content of the post can be improved, or even the wrong place, please leave a comment, I will try to correct, strive to cast a conscience blog.
Note: This article is only as a scientific research study, if I inadvertently violated your rights and interests, please be sure to timely inform, I will make corrections.

Sqlsever base Convert sorts a column of type character into an int type

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.