mssql中有一money类型,可以用来转换 declare @num INT set @num = 4564654 select replace(convert(varchar,cast(@num as money),1), '.00','') --4,564,654
月度归档: 2012年8月
IIS7.5 应用程序虚拟目录改名
在IIS 6中我们可以直接右击改名称,是因为可以改metabase,但IIS 7不再有metabae,直接更改方式不行,可采用命令方式来完成。
1.应用程序改名 C:\Windows\System32\inetsrv>appcmd list app APP "Default Web Site/" (applicationPool:DefaultAppPool) APP "Default Web Site/WebAnalytics.UI" (applicationPool:DefaultAppPool) C:\Windows\System32\inetsrv>appcmd set app "Default Web Site/WebAnalytics.UI" -path:/WebAnalytics.UI_Snake APP 对象“Default Web Site/WebAnalytics.UI”已更改 2.虚拟目录改名 C:\Windows\System32\inetsrv>appcmd list vdir VDIR "Default Web Site/" (physicalPath:%SystemDrive%\inetpub\wwwroot) VDIR "Default Web Site/test" (physicalPath:D:\) C:\Windows\System32\inetsrv>appcmd set vdir "Default Web Site/test" -path:/snake VDIR 对象“Default Web Site/test”已更改
IIS7.5 应用程序与虚拟目录的区别
1,应用程序是一个逻辑边界,这个逻辑边界可以分隔网站及其组成部分。虚拟目录则是一个真实的指针,这个指针指向了一个本地或远程物理路径。虚拟目录总是存在于应用程序之中,一个应用程序可包括多个虚拟目录。
2,直观的区别比如应用程序可以设置应用程序池,而虚拟目录则没有。
3,如一网站有两个应用程序,因为这两个应用程序相互之间是分离的,因此也无法共享InProc会话状态、应用程序文件、文件夹。而虚拟目录可以共享InProc会话状态和缓存,因为这两个虚拟目录是同一个应用程序的组成部分。
参考:http://www.cnblogs.com/guilipan/archive/2010/10/05/1500311.html
一般处理程序ashx
ashx相当于c#+html,免去了一些aspx的页面处理控件处理页面的部分.
用来ajax获取数据比用纯aspx效率要高
ashx是一个专门的用于处理HttpHandler的文件类型,用来处理自定义Http请求,可以在web.config定义运行时针对ashx的Http请求处理方式。
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory" validate="false" />
.ashx 文件用于写web handler的。HttpHandler是一个彻底自定义Http请求的方法,它通过web.config来定义Asp.Net运行时来过滤出要自定义的Http请求,发送到定义在web.config的指定类中。
利用.ashx文件是一个更好的方法,这个文件类似于.aspx文件,可以通过它来调用HttpHandler类,从而免去了普通.aspx页面的控件解析以及页面处理的过程。这个文件特别适合于生成动态文本等内容。
为程序设置快捷键
choose the program > properties > shortcut > short cut key > assign the shortcut > OK.
十六进制转换
Conversion from INT to HEX
SELECT CONVERT(VARBINARY(8), 256)
Converting from HEX to INT
SELECT CONVERT(INT, 0x00000100)
SELECT 0x00000100*1 HextoInt
from:
http://blog.sqlauthority.com/2012/07/26/sql-server-answer-how-to-convert-hex-to-decimal-or-int/
复制分发job日志输出
在job 运行代理步骤中加入:
-OutputVerboseLevel 4 -Output C:\TEMP\mergeagent.log
运行复制job即可
引自:
http://webcache.googleusercontent.com/search?q=cache:9mOGrpV0zukJ:www.mssqltips.com/sqlservertip/1679/getting-additional-error-messaging-information-for-sql-server-replication/+&cd=3&hl=en&ct=clnk&client=firefox-a
参数:
http://msdn.microsoft.com/en-us/library/ms147839.aspx
TXT文件乱码处理
将TXT格式改为doc格式,编码选择unicode而不是chinese_simplifed或chinese_traditional
产生insert脚本[转]
create procedure sp_generate_insert_script @tablename_mask varchar(30) = NULL as begin declare @tablename varchar (128) declare @tablename_max varchar (128) declare @tableid int declare @columncount numeric (7,0) declare @columncount_max numeric (7,0) declare @columnname varchar (30) declare @columntype int declare @string varchar (30) declare @leftpart varchar (max) declare @rightpart varchar (max) declare @hasident int set nocount on -- take ALL tables when no mask is given (!) if (@tablename_mask is NULL) begin select @tablename_mask = '%' end -- create table columninfo now, because it will be used several times create table #columninfo (num numeric (7,0) identity, name varchar(30), usertype smallint) select name, id into #tablenames from sysobjects where type in ('U' ,'S') and name like @tablename_mask -- loop through the table #tablenames select @tablename_max = MAX (name), @tablename = MIN (name) from #tablenames while @tablename <= @tablename_max begin select @tableid = id from #tablenames where name = @tablename if (@@rowcount <> 0) begin -- Find out whether the table contains an identity column select @hasident = max( status & 0x80 ) from syscolumns where id = @tableid truncate table #columninfo insert into #columninfo (name,usertype) select name, type from syscolumns C where id = @tableid and type <> 37 -- do not include timestamps -- Fill @leftpart with the first part of the desired insert-statement, with the fieldnames select @leftpart = 'select ''insert into '+@tablename select @leftpart = @leftpart + '(' select @columncount = MIN (num), @columncount_max = MAX (num) from #columninfo while @columncount <= @columncount_max begin select @columnname = name, @columntype = usertype from #columninfo where num = @columncount if (@@rowcount <> 0) begin if (@columncount < @columncount_max) begin select @leftpart = @leftpart + @columnname + ',' end else begin select @leftpart = @leftpart + @columnname + ')' end end select @columncount = @columncount + 1 end select @leftpart = @leftpart + ' values(''' -- Now fill @rightpart with the statement to retrieve the values of the fields, correctly formatted select @columncount = MIN (num), @columncount_max = MAX (num) from #columninfo select @rightpart = '' while @columncount <= @columncount_max begin select @columnname = name, @columntype = usertype from #columninfo where num = @columncount if (@@rowcount <> 0) begin if @columntype in (39,47) begin select @rightpart = @rightpart + '+' select @rightpart = @rightpart + 'ISNULL(' + replicate( char(39), 4 ) + '+replace(' + @columnname + ',' + replicate( char(39), 4 ) + ',' + replicate( char(39), 6) + ')+' + replicate( char(39), 4 ) + ',''NULL'')' end else if @columntype = 35 begin select @rightpart = @rightpart + '+' select @rightpart = @rightpart + 'ISNULL(' + replicate( char(39), 4 ) + '+replace(convert(varchar(1000),' + @columnname + ')' + ',' + replicate( char(39), 4 ) + ',' + replicate( char(39), 6 ) + ')+' + replicate( char(39), 4 ) + ',''NULL'')' end else if @columntype in (58,61,111) begin select @rightpart = @rightpart + '+' select @rightpart = @rightpart + 'ISNULL(' + replicate( char(39), 4 ) + '+convert(varchar(20),' + @columnname + ')+'+ replicate( char(39), 4 ) + ',''NULL'')' end else begin select @rightpart = @rightpart + '+' select @rightpart = @rightpart + 'ISNULL(convert(varchar(99),' + @columnname + '),''NULL'')' end if ( @columncount < @columncount_max) begin select @rightpart = @rightpart + '+'',''' end end select @columncount = @columncount + 1 end end select @rightpart = @rightpart + '+'')''' + ' from ' + @tablename -- Order the select-statements by the first column so you have the same order for -- different database (easy for comparisons between databases with different creation orders) select @rightpart = @rightpart + ' order by 1' -- For tables which contain an identity column we turn identity_insert on -- so we get exactly the same content if @hasident > 0 select 'SET IDENTITY_INSERT ' + @tablename + ' ON' exec ( @leftpart + @rightpart ) if @hasident > 0 select 'SET IDENTITY_INSERT ' + @tablename + ' OFF' select @tablename = MIN (name) from #tablenames where name > @tablename end end