Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Sqlserver ´æ´¢¹ý³Ì´ó¼¯ºÏ

 =================·ÖÒ³==========================
/*·ÖÒ³²éÕÒÊý¾Ý*/
CREATE PROCEDURE [dbo].[GetRecordSet] 
@strSql varchar(8000),--²éѯsql,Èçselect  * from [user]
@PageIndex int,--²éѯµ±Ò³ºÅ
@PageSize int--ÿҳÏÔʾ¼Ç¼
AS
set nocount on
declare @p1 int
declare @currentPage int
set @currentPage = 0
declare @RowCount int
set @RowCount = 0
declare @PageCount int
set @PageCount = 0
  exec sp_cursoropen @p1 output,@strSql,@scrollopt=1,@ccopt=1,@rowcount=@rowCount output --µÃµ½×ܼǼÊý
select @PageCount=ceiling(1.0*@rowCount/@pagesize)  --µÃµ½×ÜÒ³Êý
,@currentPage=(@PageIndex-1)*@PageSize+1
select @RowCount,@PageCount
exec sp_cursorfetch @p1,16,@currentPage,@PageSize
exec sp_cursorclose @p1
set nocount off
GO
=========================Óû§×¢²á============================
/*
Óû§×¢²á£¬Ò²ËãÊÇÌí¼Ó°É
*/
Create proc [dbo].[UserAdd]
(
@loginID nvarchar(50), ¡¡¡¡¡¡¡¡--µÇ¼ÕʺÅ
@password nvarchar(50), --ÃÜÂë
@email nvarchar(200) --µç×ÓÐÅÏä
)
as
declare @userID int --Óû§±àºÅ
--µÇ¼Õ˺ÅÒѾ­±»×¢²á
if exists(select loginID from tableName where loginID = @loginID)
begin
return -1;
end
--ÓÊÏäÒѾ­±»×¢²á
else if exists(select email from tableName where email = @email)
begin
return -2;
end
--×¢²á³É¹¦
else
begin
select @userID = isnull(max(userID),100000)+1 from tableName
insert into tableName
(userID,loginID,[password],userName,linkNum,address,email,createTime,status)
values
(@userID,@loginID,@password,'','','',@email,getdate(),1)
return @userID
end
==========================sql serverϵͳ´æ´¢¹ý³Ì===================
–1.¸ø±íÖÐ×Ö¶ÎÌí¼ÓÃèÊöÐÅÏ¢
Create table T2 (id int , name char (20))
GO
EXEC sp_addextendedproperty 'MS_Description', 'Employee ID', 'user', dbo, 'table', T2, 'column', id
EXEC sp_updateextendedproperty 'MS_Description', 'this is a test', 'user', dbo, 'table', T2, 'column', id
–2.ÐÞ¸ÄÊý¾Ý¿âÃû³Æ
EXEC sp_renamedb 'old_db_nam


Ïà¹ØÎĵµ£º

SQLSERVER 2000 convertº¯Êýת»»ÈÕÆÚ¸ñʽ


SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
2008-01-23 15:47
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ2008-01-15 15:51SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
SQL ServerÖÐÎİæµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄܾ­ ......

SQLServerÊý¾Ý¿â

 Sybase SQL ServerÌåϵ½á¹¹½éÉÜ
ÕªÒª£º±¾ÎÄÖ÷Òª¶ÔSybase SQL ServerÌåϵ½á¹¹½øÐнéÉÜ£¬±ãÓÚ¶ÁÕß¶ÔSybase SQL ServerÓиöÕûÌå´ó¸ÅµÄÁ˽⡣
±êÇ©£ºSybase SQL Server  Sybase  SQL Server  Ìåϵ½á¹¹
 
Sybase SQL ServerÊÇÒ»¸ö¶à¿â½á¹¹µÄRDBMS£¬Ìåϵ½á¹¹´óÖÂÈçÏ£º
1.Êý¾Ý¿â ......

ʹÓÃSQLServerÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾ä

Èç¹ûÄã¾­³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾­³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLϰ¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ­¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......

SQLServer´óÊý¾ÝÁ¿²åÈëBULK INSERT


SQLSERVER ´óÊý¾ÝÁ¿²åÈëÃüÁ
BULK INSERTÊÇSQLSERVERÖÐÌṩµÄÒ»Ìõ´óÊý¾ÝÁ¿µ¼ÈëµÄÃüÁËüÔËÓÃDTS(SSIS)µ¼ÈëÔ­Àí£¬¿ÉÒÔ´Ó±¾µØ»òÔ¶³Ì·þÎñÆ÷ÉÏÅúÁ¿µ¼ÈëÊý¾Ý¿â»òÎļþÊý¾Ý¡£ÅúÁ¿²åÈëÊÇÒ»¸ö¶ÀÁ¢µÄ²Ù×÷£¬ÓŵãÊÇЧÂʷdz£¸ß¡£È±µãÊdzöÏÖÎÊÌâºó²»¿ÉÒԻعö¡£
¡¡¡¡BULK INSERTÊÇÓÃÀ´½«ÍⲿÎļþÒÔÒ»ÖÖÌØ¶¨µÄ¸ñʽ¼ÓÔ ......

Sqlserver È¡ºº×ֵĵÚÒ»¸ö×Öĸ£¬·½±ãÄ£ºý²éѯ

 create function comm_getpy
(
    @str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
    set @word=left(@str,1)
    --Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ­×Ö·û
& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ