随笔分类 -  SQL

摘要:-- -- Author: <作者> -- Create date: <时间> -- Description: <功能说明> -- CREATE TRIGGER 触发器名称 --如果是修改用 ALTER ON 表名 AFTER DELETE,INSERT,UPDATE --触发器事件 AS BEGI 阅读全文
posted @ 2021-12-09 10:05 LuoCore 阅读(46) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/chenghaibing2008/article/details/45332993 SELECT object_name(a.parent_obj) as [表名] ,a.name as [触发器名称] ,(case when b.is_disabled= 阅读全文
posted @ 2021-11-30 11:54 LuoCore 阅读(550) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/wolfocme110/p/14727133.html 行锁使用需要注意 1、ROWLOCK行级锁确保在用户取得被更新的行,到该行进行更新,这段时间内不被其它用户所修改。因而行级锁即可保证数据的一致性,又能提高数据操作的并发性。 2、ROWLOCK告诉 阅读全文
posted @ 2021-11-04 15:32 LuoCore 阅读(740) 评论(0) 推荐(0) 编辑
摘要:set identity_insert t on insert into t (id, name) values(1, 'sqlstudy') set identity_insert t off https://database.51cto.com/art/201006/207885.htm 阅读全文
posted @ 2021-10-20 09:42 LuoCore 阅读(311) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/wanghonghu/p/4093411.html set identity_insert 表名 ON --允许对自增列Id插入指定数据 insert into table_name(Id,Name) values(1,'test') set iden 阅读全文
posted @ 2021-09-28 18:16 LuoCore 阅读(186) 评论(0) 推荐(0) 编辑
摘要:SELECT * FROM Billcode_in a LEFT JOIN Billcode_place b ON a.billcode=b.billcode AND b.id=(SELECT MAX(id) FROM Billcode_place WHERE billcode=b.billcode 阅读全文
posted @ 2021-08-10 20:29 LuoCore 阅读(222) 评论(0) 推荐(0) 编辑
摘要:https://support.microsoft.com/zh-cn/topic/%E5%A6%82%E4%BD%95%E5%88%A0%E9%99%A4-sql-server-%E8%A1%A8%E4%B8%AD%E7%9A%84%E9%87%8D%E5%A4%8D%E8%A1%8C-23da3 阅读全文
posted @ 2021-07-01 17:04 LuoCore 阅读(83) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/qq_32343577/article/details/82423393 -查询服务器的名称和实际计算机的名称,如果两者不一致,就需要修改。 use master go select @@servername; select serverproperty( 阅读全文
posted @ 2021-04-30 19:47 LuoCore 阅读(305) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/guorongtao/p/13329618.html SELECT object_name(a.parent_obj) as [表名] ,a.name as [触发器名称] ,(case when b.is_disabled=0 then '启用' e 阅读全文
posted @ 2021-03-04 16:58 LuoCore 阅读(293) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/qq395537505/article/details/88947111 https://blog.csdn.net/gnail_oug/article/details/89920195 osql -S 服务器地址 -U 用户名 -P 密码 -d 数据库名 阅读全文
posted @ 2021-01-14 18:10 LuoCore 阅读(1126) 评论(0) 推荐(0) 编辑
摘要:SELECT DISTINCT so.name AS 'table_name', so.object_id,sp.partition_id,si.name AS 'index_name',internals.type_desc,internals.total_pages, internals.use 阅读全文
posted @ 2020-12-19 21:49 LuoCore 阅读(418) 评论(0) 推荐(0) 编辑
摘要:SELECT TableId=O.[object_id], TableName=O.Name, IndexId=ISNULL(KC.[object_id],IDX.index_id), IndexName=IDX.Name, IndexType=ISNULL(KC.type_desc,'Index' 阅读全文
posted @ 2020-12-19 21:48 LuoCore 阅读(1175) 评论(0) 推荐(0) 编辑
摘要:https://bbs.csdn.net/topics/380103485 --获取约束信息 select * from information_schema.constraint_column_usage 可以获取指定数据库中的所有约束的信息以及约束与列的对应关系 go select * from 阅读全文
posted @ 2020-12-16 18:33 LuoCore 阅读(1478) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/dengguawei0519/article/details/101315699 1。找到引用这个表外键名称 SELECT * FROM sys.foreign_keys WHERE referenced_object_id=OBJECT_ID('User 阅读全文
posted @ 2020-12-11 12:50 LuoCore 阅读(494) 评论(0) 推荐(0) 编辑
摘要:RAISERROR ('错误消息!', 16, 1) ROLLBACK TRANSACTION RETURN -6000; 阅读全文
posted @ 2020-09-22 16:21 LuoCore 阅读(354) 评论(0) 推荐(0) 编辑
摘要:人总是会下意思地逃避去做自己不喜欢的事情,导致这类事情越积越多。 最后,记忆这些不喜欢的事情所产生的负担,远远超出了完成它们所花费的痛苦 sp_configure 值 'contained database authentication' 必须设置为 1 才能 创建 包含的数据库。您可能需要使用 R 阅读全文
posted @ 2020-06-28 22:27 LuoCore 阅读(1140) 评论(0) 推荐(0) 编辑
摘要:Sqlserver管理工具操作方法 https://www.xuebuyuan.com/411866.html 右键属性 扩展属性 名称指定特定名称:MS_Description 这就是注释了 Sqlserver表加注释-Sql语句操作方法 EXEC sys.sp_addextendedproper 阅读全文
posted @ 2020-03-28 14:10 LuoCore 阅读(674) 评论(0) 推荐(0) 编辑
摘要:原文链接:https://blog.csdn.net/zhoujunah/java/article/details/103513426 包含是针对数据库独立性而来的,非包含数据库(SQL Server 2012以前版本的所有数据库,以及SQL Server 2012及以后的数据库属性CONTAINM 阅读全文
posted @ 2020-03-28 11:07 LuoCore 阅读(269) 评论(0) 推荐(0) 编辑
摘要:DROP FUNCTION GetDistinctcreate function GetDistinct(@str varchar(1000))returns varchar(1000)asBEGIN declare @ret varchar(8000),@return varchar(8000) 阅读全文
posted @ 2020-01-15 15:35 LuoCore 阅读(1388) 评论(0) 推荐(0) 编辑
摘要:BEGIN TRAN SELECT * from 表明 WITH(HOLDLOCK) UPDATE 表名 SET 值=1 WHERE 字段=@carrierNo; COMMIT TRAN; ALTER PROCEDURE 名称 @字段名称 int AS BEGIN DECLARE @num VARC 阅读全文
posted @ 2019-12-12 16:45 LuoCore 阅读(883) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示