欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
sql收藏


--use tables of another database
select * from master.dbo.sysmessages
select * from master..sysmessages

--create a new table which has another table‘s structure
select * into target_table from source_table where 0=1

--to see a table or procedure existing or not
IF exists(select name from sysobjects where name=‘tablename‘ and type=‘U‘)

--
insert into target_table select * from source_table

--define output parameter and set default value
@affect_rows integer=0 output

--use procedure
create procedure  up_test 
@out_val integer=0 output
as
begin
 set @out_val=1
 return 9;
end

declare @ret_val int
declare @output_val int
exec @ret_val=up_test @out_val=@output_val output
select @ret_val,@output_val

--use transaction
begin tran
 delete from tablename
if @@error<>0
begin
 rollback tran
else
 commit tran

--define cursor
declare cur_tablename cursor FORWARD_ONLY | SCROLL
for select * from tablename
for update  [OF column_name [,...n]]

update tablename set column_name=‘r‘ where current of cur_tablename

--format string ‘050330‘ as ‘2005-03-30‘
select ‘20‘+SubString(‘050330‘,1,2) +‘-‘+ SubString(‘050330‘,3,2) +‘-‘+ SubString(‘050330‘,5,2)

--字段AA為字符型﹐它的內容為X+Y+Z。其中X和Z都為任意個(gè)字母字符﹐Y為任意個(gè)數字字符
--現我要得到X+Y﹐即去掉后而的Z。for example:‘BR0021GD ‘-->‘BR0021‘

reverse(substring(reverse(AA),patindex(‘%[^0-9]%‘,reverse(AA)),len(AA))
replace(AA,right(AA,patindex(‘%[0-9]%‘,reverse(AA))),‘‘)

--using variable as tablename(partly or fully)
declare @tablename varchar(20)
set @tablename=‘ment‘
if EXISTS (SELECT name FROM sysobjects WHERE name =
‘depart‘+@tablename AND type = ‘U‘)
begin
 print ‘table department exists‘
 exec(‘selcect * from
depart‘+@tablename)
end
else
 print ‘table department donot exists‘

--顯示文章、提交人和最后回復時(shí)間
select a.title,a.username,b.adddate from table a,(select max(adddate) adddate
 from table where table.title=a.title) b
 

--一個(gè)表中的Id有多個(gè)記錄,把所有這個(gè)id的記錄查出來(lái),并顯示共有多少條記錄數。
select d_id,count(*) from department group by d_id WITH ROLLUP
select d_id, Count(*) from department group by d_id compute count(d_id)

--add check constraint
alter table people add constraint ccme_people_sex
 check (p_sex=‘m‘ or p_sex=‘w‘);
alter table people add constraint ccme_people_birthday
 check(p_birthday is null or p_birthday like ‘[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]‘);
alter table people with nocheck
 add constraint cfme_people_dept foreign key(p_dept) references department(d_id);

--use case
select p_familyname+p_firstname as ‘姓名‘,
 case p_sex when ‘m‘ then ‘男‘ when ‘w‘ then ‘女‘ end as ‘性別‘ from tablename

--import_date is smalldatetime,type as yyyy-mm-dd
convert(varchar(10),import_date,20)
convert(varchar(10),import_date,121)

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
oracle數據庫開(kāi)發(fā)的一些經(jīng)驗積累
SQL約束和字段約束的創(chuàng )建和刪除
查詢(xún)oracle中所有用戶(hù)信息
精彩SQL收藏
SQL中decode()函數的使用
【oracle】查看當前用戶(hù)各個(gè)表的記錄數
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久