摘要:
代码 --sql多条相似内容取一条 --首先创建测试数据 if object_id('tempdb..#t') is not null drop table #t create table #t ( time int, total int, name varchar(50) ) insert int 阅读全文
摘要:
代码如下 DELETE a FROM t_StorageQty a LEFT JOIN t_Item b ON a.F_ItemID = b.F_ID WHERE isnull(b.F_ID,'') = '' 阅读全文
摘要:
查询包含某字段的所有表 select object_name(id) objName,Name as colName from syscolumns where (name like'%你要查询的字段名%') and id in(select id from sysobjects where xty 阅读全文
摘要:
获取数据库表结构 select a.COLUMN_NAME,a.DATA_TYPE,a.CHARACTER_MAXIMUM_LENGTH,b.value from information_schema.COLUMNS as a left join sys.extended_properties as 阅读全文
摘要:
数据库改名 想要达到的效果,类似于将一个文件【复制粘贴重命名】。 0.首先得断开连接,复制一份备份。然后再连接上,进行下面的操作。 1.在树形上,选中要改名的数据库,右键重命名。 2.还是它,右键,属性,文件那一页里,修改逻辑名称。 3.右键断开连接,把文件名也改了。 阅读全文
摘要:
left join的结果行数可能大于左表 阅读全文