ÓÃSQLÓï¾ä´Óaspnet_profile±íÀïÈ¡Óû§µÄProfileÖµ
The aspnet_Profile table contains the following fields: UserId, PropertyNames, PropertyValuesString, PropertyValuesBinary, and LastUpdatedDate. The PropertyNames field contains a string delimited with colons (:) that identify which profile fields are stored, what their datatype is and their offset and length.
For Example:
FirstName:S:1:7:PostalCode:S:8:5:Street:S:13:15:LastName:S:28:7:
Actual values stored in PropertyValuesString:
Viktar 601481336 Finley rd Karpach
ASP.Net profiles can store binary data as well, but usually your are interested in string data such as First and Last names. First lets create helper function, which helps to get position:length pair values:
CREATE FUNCTION dbo.fn_GetElement
(
@ord AS INT,
@str AS VARCHAR(8000),
@delim AS VARCHAR(1) )
RETURNS INT
AS
BEGIN
-- If input is invalid, return null.
IF @str IS NULL
OR LEN(@str) = 0
OR @ord IS NULL
OR @ord < 1
-- @ord > [is the] expression that calculates the number of elements.
OR @ord > LEN(@str) - LEN(REPLACE(@str, @delim, '')) + 1
RETURN NULL
DECLARE @pos AS INT, @curord AS INT
SELECT @pos = 1, @curord = 1
-- Find next element's start position and increment index.
WHILE @curord < @ord
SELECT
@pos = CHARINDEX(@delim, @str, @pos) + 1,
@curord = @curord + 1
RETURN
CAST(SUBSTRING(@str, @pos, CHARINDEX(@delim, @str + @delim, @pos) - @pos) AS INT)
END
And then code for the actual worker function:
CREATE FUNCTION dbo.fn_GetProfileElement
(
@fieldName AS NVARCHAR(100),
@fields AS NVARCHAR(4000),
@values AS NVARCHAR(4000))
RETURNS NVARCHAR(4000)
AS
BEGIN
-- If input is invalid, return null.
IF @fieldName IS NULL
&nb
Ïà¹ØÎĵµ£º
Ò»¡¢±¸·ÝÊý¾Ý¿â
1¡¢´ò¿ªSQLÆóÒµ¹ÜÀíÆ÷£¬ÔÚ¿ØÖÆ̨¸ùĿ¼ÖÐÒÀ´Îµã¿ªMicrosoft SQL Server
2¡¢SQL Server×é-->Ë«»÷´ò¿ªÄãµÄ·þÎñÆ÷-->Ë«»÷´ò¿ªÊý¾Ý¿âĿ¼
3¡¢Ñ¡ÔñÄãµÄÊý¾Ý¿âÃû³Æ£¨ÈçÂÛ̳Êý¾Ý¿âForum£©-->È»ºóµãÉÏÃæ²Ëµ¥ÖеŤ¾ß-->Ñ¡Ôñ±¸·ÝÊý¾Ý¿â
4¡¢±¸·ÝÑ¡ÏîÑ¡ÔñÍêÈ«±¸·Ý£¬Ä¿µÄÖеı¸·Ýµ½Èç¹ûÔÀ´Óз¾¶ºÍÃû³ ......
±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
Ò²¿ÉÒÔʹÓÃÁªºÏÖ÷¼ü id+id2+id3+……
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º
SELECT TOP 10 *
from TestTable
WHERE (ID NOT IN
(SELECT TOP 20 id
&nb ......
1.ÏÔʾ±¾ÔµÚÒ»Ìì
SELECT DATEADD(mm,DATEDIFF(mm,0,getdate()),0)
select convert(datetime,convert(varchar(8),getdate(),
120)+’01’,120)
2.ÏÔʾ±¾ÔÂ×îºóÒ»Ìì
select dateadd(day,-1,convert(datetime,convert
(varchar(8),dateadd(month,1,getdate()),120)+’01’,120))
SELECT ......
SQL ServerÓû§×Ô¶¨Ò庯ÊýºÍ´æ´¢¹ý³ÌÓÐÀàËƵŦÄÜ£¬¶¼¿ÉÒÔ´´½¨À¦°óSQLÓï¾ä£¬´æ´¢ÔÚserverÖй©ÒÔºóʹÓá£ÕâÑùÄܹ»¼«´óµØÌá¸ß¹¤×÷ЧÂÊ£¬Í¨¹ýÒÔϵĸ÷ÖÖ×ö·¨¿ÉÒÔ¼õÉÙ±à³ÌËùÐèµÄʱ¼ä£º
¡¡¡¡ 1 Öظ´Ê¹Óñà³Ì´úÂ룬¼õÉÙ±à³Ì¿ª·¢Ê±¼ä¡£
¡¡¡¡ 2 Òþ²ØSQLϸ½Ú£¬°ÑSQL·±ËöµÄ¹¤×÷Áô¸øÊý¾Ý¿â¿ª·¢ÈËÔ±£¬¶ø³ÌÐò¿ª·¢Ô±Ôò¼¯Öд¦Àí¸ß¼¶±à³Ì ......
ÊÂÎñÈÕÖ¾ÀïÃ擲ؔןܶàÓÐÓõÄÐÅÏ¢¡£ËäÈ»SQL Server±¾Éí²¢Ã»ÓÐÌṩ·ÖÎö¹¤¾ß£¬µ«ÊÇÎÒÃÇ¿ÉÒÔʹÓõÚÈý·½¹¤¾ßÀ´Ò»Ì½¾¿¾¹¡£
Red GateÈí¼þÌṩÁËÒ»¿î½Ð×öSQL Log RescueµÄÃâ·Ñ¹¤¾ß£¬µ«ÊÇÖ»Ö§³ÖSQL Server 2000¡£ApexSQLºÍLumigent¹«Ë¾ÌṩµÄÁ½¿îÈí¼þ·Ö±ð½Ð×öApexSQL LogºÍLog Explorer£¬ËüÃÇÖ§³ÖSQL Server7¡¢2000ºÍ ......