SQL statement Consolidation

Source: Internet
Author: User
Query the random value of if (object_id (tempdb .. # cc, U) isnotnull) droptable # ccgodeclare @ aintset @ a0while @ a15beginif @ a0selectfloor (rand () * 3) + 3 asccinto # ccelseinsertinto # ccvalues (floor (rand () * 3) + 3) set @ a + 1endselect *

Query the random value of if (object_id ('tempdb .. # cc ', 'U') is not null) drop table # cc go declare @ a int set @ a = 0 while @ a15 begin if @ a = 0 select floor (rand () * 3) + 3 as cc into # cc else insert into # cc values (floor (rand () * 3) + 3) set @ a = @ a + 1 end select *

Query random values in each row

If (object_id ('tempdb .. # CC', 'U') is not null)
Drop table # cc
Go
Declare @ a int
Set @ a = 0
While @ a <15
Begin
If @ a = 0
Select floor (rand () * 3) + 3 as cc into # cc
Else
Insert into # cc values (floor (rand () * 3) + 3)
Set @ a = @ a + 1
End
Select * from # cc

Connection Query

Select a. Class_Content, * from T1103.dbo. T101_1
Inner join (SELECT Class_Code, Class_Content FROM WssMng_SXZ.dbo.ClassTable
WHERE (Fk_ClassName = 'case source') as a on a. Class_Code = T101_1.M101_1_111
Where unitID = '000000'

, Hong Kong Server rental, US space, Hong Kong server

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.