Grant permission to only create/alter/drop proc
grant create procedure to [heytest]GRANT--end --change schema owner ALTER ON SCHEMA::dbo TO heytestUSEGO [heytest1]ALTERGO AUTHORIZATION ON SCHEMA::[db_owner] TO [dbo][@more@]
求连续出现三次的某一数值的算法
DECLARE @T TABLE (ID INT,NAME VARCHAR(4),STATUS INT)INSERT INTO @TSELECT 1,'aa',0 UNION ALLSELECT 2,'aa',1 UNION ALLSELECT 3,'aa',0 UNION ALLSELECT 4,'bb',1 UNION ALLSELECT 7,'bb',1 UNION ALLSELECT 9,'bb',1 UNION ALLSELECT 10,'aa',0 UNION ALLSELECT 11,'cc',0----常规语句法,此方法不要求主键连续,但假如求连续一百次的就脸长了select a.name from @t a,@t b,@t cwhere a.name=b.name and b.name=c.name and b.id=(select top 1 id from @t where id>a.id order by id) and c.id=(select top 1 id from @t where
sql server 删除重复记录
DELETE TMP FROM (SELECT ID,MIN(STATE) STATE FROM TMP GROUP BY ID HAVING COUNT(1)>1) B WHERE TMP.ID=B.ID AND TMP.STATE<>B.STATE[@more@]
SQL SERVER 快速重建所有视图
DECLARE test_cursor CURSORFOR select id,name from invest..sysobjects where OBJECTPROPERTY(id, N'IsView') = 1 and name not like 'sys%'DECLARE @name varchar(100)declare @id intDECLARE @SQLSTR varchar(4000)OPEN test_cursorFETCH NEXT FROM test_cursor INTO @id,@nameWHILE (@@fetch_status <> -1)BEGIN BEGIN set @sqlstr='drop view '+@name select @sqlstr select 'go' --select text from sysobjects o,syscomments c where o.id=c.id and xtype='V' and name not like
dos 命令执行SQL脚本的方法
ORACLE:sqlplus user/password@SID "d:test.sql"SQL SERVER:osql -S servername -U user -P password -i "d:test.sql"[@more@]
从后往前截取字符串
select substr('asdefeeffb',(instr('asdefeeffb','f',-1)-1)-length('asdefeeffb')) from dual[@more@]
Oracle Date Function 讲解和事例
Oracle Date Function 讲解和事例请大家记住 1 year=1*12 months1 day=24 hours=24*(1*60mins)=24*60*(1*60 seconds)1 week =7 days注意:黑色字体是 oracle 8i,9i都可以使用的函数,蓝色字体是 Oracle9i新增的部分。请大家在使用时,注意版本限制。add_monthscurrent_datecurrent_timestampdatimezoneextract(datetime)last_daymonths_betweennew_timenext_dayroundSYSDATEsystimestampTO_DATEtrunc()1: Add_Months 语法: Add_Months(d,n) 函数 -- n可正可负 作用: Add_Months(d,n) 返回日期 D 加上n 月的日期Example:A:下个月的今天
关于归档失败后数据库当机的处理方法
log_archive_dest_1 = "location=E:oracleoradatamisarchive reopen=2"[@more@]
ORA-12545 连接因对象主机或对象不存在而失败 的处理办法
SMSDB =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.190.9.241)(PORT = 1521)))(CONNECT_DATA =(SID = smsdb)(SERVER=DEDICATED)))[@more@]
dos命令中的FOR循环
DOS 下的FOR循环 2003-06-21 阅读: 4400 for /L %%A in(1,1,254) do ping 192.168.1.%%A |find "Reply" >>ip.txt //1开始,步进=1,到254for /F %%A in (ip.txt) do arp -s %%a ///F从文件中取每一行for /D %%A in (*.*) do dir $$A // /D 取目录名[@more@]
ora-06413原因之所在
Here u go Error: ORA 6413 Text: Connection not open.------------------------------------------------------------Cause: Unable to establish connection.Action: Use diagnostic procedures to ascertain exact problem.Solution Description--------------------You are starting the application from a directory with a special character in the name.A simple testcase:create a directory c:test(4)copy odbctst.exe to this directory and start it from this directoryyou will get the ora-6413 when trying to connect
oracel命令速查
第一章:日志管理 1.forcing log switches sql> alter system switch logfile; 2.forcing checkpoints sql> alter system checkpoint; 3.adding online redo log groups sql> alter database add logfile [group 4]sql> ('/disk3/log4a.rdo','/disk4/log4b.rdo') size 1m; 4.adding online redo log members sql> alter database add logfile member sql> '/disk3/log1b.rdo' to group 1, sql> '/disk4/log2b.rdo' to group 2; 5.changes the name of the online redo logfile sql> alter database rename
sql server中建立到oracle的链接server
select * from sysserverssp_addlinkedserver 'OrclDB', 'Oracle', 'MSDAORA', 'hbmis'sp_addlinkedsrvlogin 'OrclDB', false, 'sa', 'czmis', 'mis'select top 100 * from OrclDB..CZMIS.YD_YHJBDA[@more@]