sql server里面sql语句执行update,delete操作的时候,对表用别名的写法

sql server里面sql语句执行update,delete操作的时候,对表用别名的写法:

update a set a.name=b.StuName from table1 a inner join table2 b on a.id=b.id;

delete t from table1 t where
exists(select 1 from table2 a where a.col1=t.col1 
and a.col2=t.col2 and a.col2=100)

下面的写法是错误的:

update table1 a set a.name='XXX' where a.name='';

char(9) 水平制表符

char(10)换行键

char(13)回车键

1> 回车符  char(13)

select  replace(barcode, char(13) , '<br>')  as barcode from SickInfo

2>换行符 char(10)select *replace(barcode, char(10), '<br>') as barcode from SickInfo

3>回车换行符 char(13)+char(10)

select replace(barcode, char(13)+char(10), '<br>') as barcode from SickInfo

4>在表中过滤包含回车换行符的字段barcode的记录

select * from SickInfo where charindex(char(10)+char(13),barcode)>0

原文地址:https://www.cnblogs.com/junior/p/2421486.html