Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Commonly used SQL statements (1)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Createtable#tmp (uuidint,cNamenvarchar (50)) insertinto#tmpvalues (1gime 'apple') insertinto#tmpvalues (2je 'grape') insertinto#tmpvalues (1meme 'apple 111') insertinto#tmpvalues (2meme' grape 111') insertinto#tmpvalues (1meme 'apple 222') insertinto#tmpvalues (third' orange')-query Select*from#tmp-- to put the results together Selectx.uuid,left (cName,len (cName)-1) ascNamefrom (Selectuuid, (SelectcName+') 'from#tmpwhereuuid=t1.uuidforxmlpath (') ascNamefrom#tmpast1groupbyuuid) xps: this function can only be achieved with forxml in SQL SERVER.

-- add a record insertinto [dbo]. [T _ BU_STOCK] ([STORAGE_YEAR], [STORAGE_MONTH], [STORAGE_DAY], [STORAGE_DATE], [VEHICLE_BELONG], [CAR_SERIES_CODE]) Values ('2015, July 22, 2015, July 22, 2015, July 22, 2015)

-- add records insertinto#T_BU_STOCK ([STORAGE_YEAR], [STORAGE_MONTH], [STORAGE_DAY], [STORAGE_DATE], [VEHICLE_BELONG], [CAR_SERIES_CODE]) Select 2015Ji 22, 2015-07-22.

The results of the query table insertinto#T_BU_STOCK ([STORAGE_YEAR], [STORAGE_MONTH], [STORAGE_DAY], [STORAGE_DATE], [VEHICLE_BELONG], [CAR_SERIES_CODE]) Select 2015Ji 22, Jul 22, 2015, July 22, 2015 (July 22, 2015)

-- execute the stored procedure (the value returned by the stored procedure must be consistent with the column value of the added table) insertinto#T_BU_STOCKEXECPdd_Stock

-- backup table Select*intoT_BU_DLR_2015_08_20fromT_BU_DLR-- to create temporary table Select*into#T_BU_DLR_2015_08_20fromT_BU_DLR

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report