清除多余字符

--清除多余字符
--'
--char(9) 水平制表符
--char(10)换行键
--char(13)回车键
REPLACE( REPLACE( REPLACE(REPLACE([ProductID],'''','') , CHAR(10) ,''),char(9),''),char(13),'')

 

循环输出ID 00000000#

declare @x int
declare @id varchar(10)
set @x = 0 
while(@x <= 30) 
begin 
	set @x = @x + 1  
	set @id = RIGHT('0000000000'+CONVERT(VARCHAR,@x),10)
	print @id 
end

  

关联更新

UPDATE [MacauCar].[dbo].[Vehicle]
	SET [MacauCar].[dbo].[Vehicle].[BrandID] =[MacauCar].[dbo].[Brands].[BrandID]
	FROM [MacauCar].[dbo].[Brands]
	WHERE[MacauCar].[dbo].[Series].[BrandID]= [MacauCar].[dbo].[Brands].[BrandName]

  

 

posted on 2015-06-30 16:09  QZB  阅读(122)  评论(0编辑  收藏  举报