標籤:1、for xml path(‘str‘)select ID,CreateTime from dbo.ArticleInfo for xml Path(‘mytitle‘)結果:(注意:如果是select ID,CreateTime from dbo.ArticleInfo for xml path下面的結果中<mytitle>就變為預設的<row>)<mytitle> <ID>4</ID>
標籤:--當前資料庫建立角色 exec sp_addrole ‘rapp‘--分配視圖許可權 GRANT SELECT ON veiw TO [角色] --指定視圖列表ViewCardBaseInfo--GRANT SELECT ON v_city TO rapp--GRANT SELECT ON v_lp TO rapp--GRANT SELECT ON v_qy TO rapp GRANT SELECT ON ViewCardBaseInfo TO rapp
標籤:drop proc qiuhecreate proc qiuhe --用資料庫語言做累加求和@n intas declare @sum int --相當於C#語言裡定義變數 declare @i int set @sum=0 --再給變數賦值 ,相當於C#語言裡的 int sum=0 set @i=1 -- 相當於for 迴圈裡的 int i=1 (int i=1;i<=n;i++) while @i<[email protected]
標籤:---分頁查詢select top 2 *from student where sno not in (select top 2 sno from student) --not in() 屏蔽掉前兩行 在此基礎上再取前兩行--分頁的預存程序 --直接用輸入參數當作表名和列名,無法被識別,先用‘++‘拼接成字串,然後用exec去執行,exec依然會把這個字串當作語句執行create proc fenye1@nowye int ,--當前頁@number
標籤:create trigger Course_Deleteon courseinstead of deleteas declare @cno varchar(20) --定義變數 select @cno = cno from deleted --暫存資料表裡的資訊是instead of 替換 delete要刪除的資訊 delete from score where cno = @cno --instead of 替換操作後執行的代碼命令
標籤:SQL Server 串連問題案例解析(1)轉載自:http://blogs.msdn.com/b/apgcdsd/archive/2015/04/27/sql.aspx?CommentPosted=true#commentmessage Microsoft Network Monitor(Netmon)是由微軟發布的一款網路通訊協定資料分析工具,利用Netmon可以捕獲網路資料並進行查看和分析。在處理SQL Server