sql server中sql语句(二)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/user_987654321/article/details/88973123

sql server中sql语句(二)

复制表

  • 复制结构和数据
select * into  new_table from old_table;
  • 复制结构
select * into  new_table from old_table where 1=2;

数据转化

  • cast
cast(列名 as 要转化成的数据类型[(长度)])

条件判断

case when 判断语句 then '值1' else '值2' end

还有一种限定布尔类型列的方式

case 列名 when 101truethen '值1' else '值2' end

猜你喜欢

转载自blog.csdn.net/user_987654321/article/details/88973123