MSSQL 常用内置函数

一、判断表是否存在

IF objectproperty(object_id(@tableName),'IsUserTable') IS NOT NULL
    PRINT '存在'
ELSE	
    PRINT '不存在'

 二、批量修改列数据 

1 DROP TABLE #temp
2 SELECT * INTO #temp FROM SCK_tbImages
3 UPDATE SCK_tbImages SET BigImgWebUrl = (SELECT REPLACE(temp.BigImgWebUrl,'192.168.0.21','202.85.222.199')  FROM #temp temp WHERE temp.ImgID = SCK_tbImages.ImgID)
4 WHERE BigImgWebUrl IS NOT NULL AND PATINDEX('%192.168.0.21%',SCK_tbImages.BigImgWebUrl) >0
5 SELECT *FROM  SCK_tbImages
View Code

 

posted on 2014-11-25 10:04  胖子略显瘦  阅读(283)  评论(0编辑  收藏  举报