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

ÓÃ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


Ïà¹ØÎĵµ£º

SQL ServerÊý¾Ý¿â±¸·ÝºÍ»Ö¸´´ëÊ©

Ò»¡¢±¸·ÝÊý¾Ý¿â
1¡¢´ò¿ªSQLÆóÒµ¹ÜÀíÆ÷£¬ÔÚ¿ØÖÆ̨¸ùĿ¼ÖÐÒÀ´Îµã¿ªMicrosoft SQL Server
2¡¢SQL Server×é-->Ë«»÷´ò¿ªÄãµÄ·þÎñÆ÷-->Ë«»÷´ò¿ªÊý¾Ý¿âĿ¼
3¡¢Ñ¡ÔñÄãµÄÊý¾Ý¿âÃû³Æ£¨ÈçÂÛ̳Êý¾Ý¿âForum£©-->È»ºóµãÉÏÃæ²Ëµ¥ÖеŤ¾ß-->Ñ¡Ôñ±¸·ÝÊý¾Ý¿â
4¡¢±¸·ÝÑ¡ÏîÑ¡ÔñÍêÈ«±¸·Ý£¬Ä¿µÄÖеı¸·Ýµ½Èç¹ûÔ­À´Óз¾¶ºÍÃû³ ......

SQL·ÖÒ³·½·¨

±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[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 ......

ms sqlµ½mysqlµÄÒÆÖ²£º¹ØÓÚÊý¾ÝÀàÐÍÒÆÖ²µÄһЩÎÊÌâ

   ms sqlÖеÄintÐÍĬÈÏÊÇ4룬mysqlµÄintÐÍĬÈÏÊÇ11λ£¬Ç°Õßµ½ºóÕßµÄÒÆÖ²²»»áÓÐʲôÒþ»¼£¬µ«ÊǺóÕßµ½Ç°ÕßµÄÒÆÖ²¾Í´æÔÚλÊý²»¹»£¬²»ÄÜ´æ´¢´óÊýµÄÒþ»¼¡£
   »¹ÓÐbigint£¬ms sqlÊÇ8룬mysqlĬÈÏÊÇ20λ¡£ ......

Linq to SQL Like Operator(תÔØ)


As a response for customer's question, I decided to write about using Like Operator in Linq to SQL queries.
Starting from a simple query from Northwind Database;
var query = from c in ctx.Customers
            where c.City == "London"
&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ