SqlServer .判断表Users是否存在 if object_id(N'Users',N'U') is not null print '存在' else print '不存在' .判断表Users中是否存在Name这一列 if exists(select * from syscolumns where id=object_id('Users') and name='Name' collate Chinese_PRC_CI_AI_WS) print '存在' else print '不存在'
sqlserver和oracle修改表结构常用SQL Server:1.增加列 ALTER TABLE users ADD address varchar(30);2.删除列 ALTER TABLE users DROP COLUMN address;3.修改字段类型 ALTER TABLE users ALTER COLUMN address varchar(80);4.重命名列: EXEC sp_rename 'WN_CALL_INFO.[CUST_CODE]', 'CUST_ID'
SQLServer中查询的数字列前面补0返回指定长度的字符串: 如: 角本如下: /****** Script for SelectTopNRows command from SSMS ******/ SELECT TOP [ID] ,[SN] ,[Name] FROM [EduDB].[dbo].[TestTab] ',SN) from TestTab; )+CAST(SN AS varchar()),) AS 'SN' from TestTab; )),) as 'sn' from Test
创建: create trigger trigger_name on {table_name view_name} {for After Instead of } [ insert, update,delete ] as sql_statement 删除触发器: drop trigger trigger_name 查看数据库中已有触发器: use jxcSoftware go select * from sysobjects where xtype='TR' 修改触发器: alter trigg
alv数据表维护表时错误行需要高亮度显示 gt_index_rows TYPE lvc_t_row,"用以存放要选择行的内表 gs_index_rows TYPE lvc_s_row."用以存放要选择行的工作区 IF gf_error IS NOT INITIAL. "判断修改后是否有不合法数据,有则选中错误行 CALL METHOD gr_alvgrid->set_selected_rows EXPORTING it_index_rows = gt_index_row
Oracle增加一列.修改一列数据类型: 添加一列: alter table A add( CFYJSNR varchar2(20)); 修改列: alter table A rename column CFYJSNR to CFJYSNR; 修改列的类型: alter table A modify cfyj varchar(200); 删除数据库一列 alter table A drop column CFYJSNR 使用心得,当使用plsql执行的时候,注意
摘自: http://www.cnblogs.com/badboy2008/articles/1145465.html MSSQL Server修改标识列方法 ----允许对系统表进行更新exec sp_configure 'allow updates',1reconfigure with overrideGO ----取消标识列标记update syscolumns set colstat = 0 where id = object_id('tablename') and colstat