use master
go
--Çл»masterÊý¾Ý¿â
if exists(select 1 from sysdatabases where name = N'test')
--×¢Òâ¸ÃͬÃûÊý¾Ý¿âÊÇ·ñ»¹ÒªÓõ½
begin
drop database test
end
go
create database test
on
primary
( name = 'testprimary', --Ö÷Êý¾ÝÎļþÂß¼Ãû
filename = 'D:\testprimary.mdf',--Ö÷Êý¾ÝÎļþ´æ·Å·¾¶
size = 1MB,--³õʼ´óС
maxsize = 10MB,--×î´ó´óС
filegrowth = 1MB--Ôö³¤Á¿
)
filegroup data --½¨Á¢Êý¾Ý·Ö×é
(name='testdata',--´ÎÊý¾ÝÎļþÂß¼Ãû
filename=‘D:\testdata.ndf',--´ÎÊý¾ÝÎļþ´æ´¢Â·¾¶
size=1MB,--³õʼ´óС
maxsize=10MB£¬--×î´ó´óС
filegrowth=1MB--Ôö³¤Á¿
£©
log on --ÈÕÖ¾Îļþ
( name = 'test_ldf', --ÈÕÖ¾ÎļþÂß¼Ãû
filename = 'D:\test.ldf',--ÈÕÖ¾Îļþ´æ·Å·¾¶
size = 1MB,--³õʼ´óС
maxsize = 10MB,--×î´ó´óС
filegrowth = 1MB--Ôö³¤ËÙ¶È
)
go
......
½ñÌì¸Õ¿ªÍ¨Õâ¸öС²©£¬×÷ΪÇì×££¬°ÑÎÒÒÔǰ¿Õ¼äÖеÄһƪÎÄÕÂת¹ýÀ´¡£
Ï£Íû¶Ô
ÎÊÌ⣺ÓÉÓÚ°²×°sql server 2000 sp4ÒÔºóÐÞ¸ÄÁË·þÎñÆ÷µÄÃû³Æµ¼ÖÂSQLÖб£ÁôµÄ·þÎñÆ÷Ãû²»ÕýÈ·¡£
½â¾ö·½·¨£º
1.select @@servername
²é¿´·µ»ØÖµÊÇ·ñÓëÏÖÔÚ»úÆ÷Ãû²»Ò»Ö£¨Èç¹ûÒ»Ö¾ÍÊDZðµÄÎÊÌâÁË£©
2.exec sp_helpserver
²é¿´Ó¦¸ÃÓÐNAMEÓënetwork_name²»Ò»ÖµÄÇé¿ö£¬ÎÊÌâ¾ÍÔÚÕâÀï¡£
3.exec sp_dropserver '<1>'
<1>:¾ÍÊÇ'select @@servername'µÄ·µ»ØÖµ¡£
4.exec sp_addserver '<2>','local'
<2>:ÏÖÔڵļÆËã»úÃû
5.ÖØÐÂÆô¶¯SQL SERVER·þÎñ
6.¼ì²éµÚ1£¬2²½µÄÊý¾ÝÊÇ·ñÒѾÐ޸ĹýÀ´¡£
È»ºóÄã¾Í¿ÉÒÔÖØÐÂ×¢²áÁË¡£
¶ÔÓÚÌáʾxp_cmdshell´æ´¢¹ý³ÌûÓÐÕÒµ½µÄÎÊÌâÓÃÏÂÃæÓï¾ä½â¾ö¡££¨Ç°ÌáÊDZ£Ö¤xplog70.dllÔÚÖ¸¶¨µÄĿ¼Ï£©
use master
go
sp_addextendedproc 'xp_cmdshell','C:\Program Files\Microsoft SQL Server\MSSQL\Binn\xplog70.dll'
go
grant all on xp_cmdshell to public ......
use test
go
if exists table student is not null
else
drop table student
go
create table database_name.schema_name.table_name
(ÊôÐÔ1 ×Ö·ûÀàÐÍ Ô¼Êø£¬
ÊôÐÔ2 ×Ö·ûÀàÐÍ Ô¼Êø....
)
go
insert into table_name values ('ÊôÐÔ1’£¬‘ÊôÐÔ2’£¬......£©
--²åÈëÊý¾Ý
Ôö¼Ó×ֶΣºalter talbe ±íÃû add ×Ö¶ÎÃû ÀàÐÍ(¿í¶È[,СÊýλ] )
ÐÞ¸Ä×ֶΣºalter table ±íÃû alter column ×Ö¶ÎÃû ÀàÐÍ(¿í¶È[,СÊýλ] )
ÖØÃüÃû×ֶΣºalter table ±íÃû rename column ×Ö¶ÎÃû TO ÐÂ×Ö¶ÎÃû
ɾ³ý×ֶΣºalter table ±íÃû drop column ×Ö¶ÎÃû ......
¼ì²âËÀËø
Èç¹û·¢ÉúËÀËøÁË£¬ÎÒÃÇÔõôȥ¼ì²â¾ßÌå·¢ÉúËÀËøµÄÊÇÄÄÌõSQLÓï¾ä»ò´æ´¢¹ý³Ì£¿
ÕâʱÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏ´洢¹ý³ÌÀ´¼ì²â£¬¾Í¿ÉÒÔ²é³öÒýÆðËÀËøµÄ½ø³ÌºÍSQLÓï¾ä¡£SQL Server×Ô´øµÄϵͳ´æ´¢¹ý³Ìsp_whoºÍsp_lockÒ²¿ÉÒÔÓÃÀ´²éÕÒ×èÈûºÍËÀËø, µ«Ã»ÓÐÕâÀï½éÉܵķ½·¨ºÃÓá£
use master
go
create procedure sp_who_lock
as
begin
declare @spid int,@bl int,
@intTransactionCountOnEntry int,
@intRowcount int,
@intCountProperties int,
@intCounter int
create table #tmp_lock_who (
id int identity(1,1),
spid smallint,
bl smallint)
IF @@ERROR<>0 RETURN @@ERROR
insert into #tmp_lock_who(spid,bl) select 0 ,blocked
&n ......
If the SQL data type is 'timestamp', we need to use ResultSet.getBytes() to retrieve its value. If the SQL data type is 'datetime', we can use ResultSet.getTimestamp(). It is said timestamp is interanlly saved as binary data.
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection
("jdbc:sqlserver://<url_address>;user=<user>;password=<password>;database=<database>");
Statement statement = conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("...");
while (rs.next()) {
System.out.println(rs.getTimest ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
if (text && text.length > 300) {
text = text + "\r\n\n±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£º" + location.href;
clipboardData.setData("text", text);
}
}, 100);
}
}
http://blog.csdn.net/xiaoyu9805119/archive/2007/10/15/1825803.aspx
¶ÔÓÚÏÖÔÚµÄÓ¦ÓóÌÐòÀ´Ëµ£¬´Ó»ù´¡µÄдÆðµÄʱ´úÒѾԶȥÁË£¬¸ü¶àµÄÊǴӼܹ¹£¬¿ÉÀ©Õ¹ÐÔÒÔ¼°¿Éά»¤ÐÔÉÏÀ´¿¼ÂÇÁË¡£Òò´ËÒ²²úÉúÁ˺ܶàµÄ¿ò¼Ü£¬ÓÈÆäÔÚ¿ªÔ´ÊÀ½çËãµÄ
ÉÏÊǰٻ¨Æë·ÅµÄ¾°Ï󡣸÷ÖÖ¸÷ÑùµÄģʽºÍ¼Ü¹ ......