列名不一定要相同,只要你在HH中列出要插入列的列表跟select from mm表中的選擇的列的列表一一對應就可以了,當然兩邊的資料類型應該是相容的。 insert into hh (fielda,fieldb,fieldc) select fieldx,fieldy,fieldz from mm 複製代碼 代碼如下: ---更新計量點中不存在的資料,將台帳中的資訊轉移到計量點中 insert into MetricPoints
複製代碼 代碼如下:eclare @str nvarchar(50);set @str='462,464,2';select @str as '字串'select len(@str) as '字元長度'select charindex(',',@str,1) as '第一個逗號的索引值'select LEFT(@str,charindex(',',@str,1)-1) as '第一個值'select SUBSTRING(@str,charindex(',',@str,1)+1,len(@str)
使用遊標實現複製代碼 代碼如下:declare @id1 int,@oldid int,@e_REcordid int ,@Olde_REcordid intDECLARE price CURSORFOR SELECT id ,E_recordId FROM evaeve order by E_recordId descOPEN priceFETCH NEXT FROM price into @oldid,@Olde_REcordidwhile
Dim xStatus,tStatus,vServer,vHeader,vRsBody GetError=InputBox("請輸入網站,例如:http://www.hackerxfiles.com/files/list.asp?id=415","請輸入網址","http://www.hackerxfiles.com/files/list.asp?id=415") If GetError = "" Then MsgBox("輸入錯誤,程式結束!"
下面為您介紹sql下用了判斷各種資源是否存在的代碼,需要的朋友可以參考下,希望對您學習sql的函數及資料庫能夠有所協助。-- 庫是否存在if exists(select * from master..sysdatabases where name=N'庫名')print 'exists'elseprint 'not exists'-- 判斷要建立的表名是否存在if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].
例如:我想將String[] str = {"4","5","6"}轉化為“‘4',‘5',‘6'”字串。這樣我就可以用sql查詢:select * from tableName id in (字串)了。 項目中實現的源碼如下: 複製代碼 代碼如下: StringBuffer idsStr = new StringBuffer(); for (int i = 0; i < ids.length; i++) { if (i > 0) { idsStr.append(","); }