³£Óô洢¹ý³Ì¼¯½õ,¶¼ÊÇһЩmssql³£ÓõÄһЩ£¬´ó¼Ò¿ÉÒÔ¸ù¾ÝÐèҪѡÔñʹÓá£
¡¡¡¡=================·ÖÒ³==========================
¡¡¡¡/*·ÖÒ³²éÕÒÊý¾Ý*/
¡¡¡¡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))
¡¡¡¡
ËäÈ»²»ÄÜÍêÈ«±ÜÃâËÀËø£¬µ«¿ÉÒÔʹËÀËøµÄÊýÁ¿¼õÖÁ×îÉÙ¡£½«ËÀËø¼õÖÁ×îÉÙ¿ÉÒÔÔö¼ÓÊÂÎñµÄÍÌÍÂÁ¿²¢¼õÉÙϵͳ¿ªÏú£¬ÒòΪֻÓкÜÉÙµÄÊÂÎñ£º
»Ø¹ö£¬¶ø»Ø¹ö»áÈ¡ÏûÊÂÎñÖ´ÐеÄËùÓй¤×÷¡£
ÓÉÓÚËÀËøÊ±»Ø¹ö¶øÓÉÓ¦ÓóÌÐòÖØÐÂÌá½»¡£
ÏÂÁз½·¨ÓÐÖúÓÚ×î´óÏ޶ȵؽµµÍËÀËø£º
°´Í¬Ò»Ë³Ðò·ÃÎʶÔÏó¡£
±ÜÃâÊÂÎñÖеÄÓû§½»»¥¡£
±£³ÖÊÂÎñ¼ò¶Ì ......
SQL ServerÖе÷Ó÷½·¨Ê±£¬¾³£Óöµ½.»òÊÇ::Á½ÖÖµ÷Ó÷½·¨£¬ÆäÖÐ. ÊÇʵÀýµ÷Ó÷½·¨£¬::ÊǾ²Ì¬µ÷Ó÷½·¨¡£Èç¹û´ó¼Ò¶ÔC#Óï·¨ÊìϤµÄ»°£¬. ¶ÔÓ¦C#Öе÷ÓÃʵÀý·½·¨£¬:: ¶ÔÓ¦C#ÖеÄstatic·½·¨¡£
ÏÂÃæ¸ø³öÒ»¸öSQL ServerµÄʵÀý£¬ÏÂÃæµÄSQLÔËÐÐÔÚ2008»·¾³Ï£º
DECLARE @g geography;
SET @g = geography::Parse('LINESTRING(-122.360 ......