用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语句的处理
ps:MSDN摘
优化 在基础表上(不引用视图或远程表)的 SELECT 语句:SELECT 语句是非程序性的,这意味着数据库服务器必须分析语句,以决定提取所请求数据的最有效方法
处理上面步骤的组件称为“查询优化器”:
输入:查询、数据库方案(表和索引的定义)以及数据库统计信息
& ......
用Java连接SQL Server2000数据库有多种方法,下面介绍其中最常用的两种(通过JDBC驱动连接数据库)。
1. 通过Microsoft的JDBC驱动连接。此JDBC驱动共有三个文件,分别是mssqlserver.jar、msutil.jar和msbase.jar,可以到微软的网站去下载(http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B ......
查询通知是在 Microsoft SQL Server 2005 中以及 ADO.NET 2.0 的 System.Data.SqlClient 命名空间中引入的。查询通知建立在 Service Broker 基础结构的基础上,使应用程序可以在数据更改时收到通知。如果应用程序提供数据库中信息的缓存(例如 Web 应用程序),需要在源数据更改时接收通知,此功能特别有用。
通过三种方式 ......
1.
select top m * from tablename where id not in (select top n id from tablename)
2.
select top & ......
从2000开始就是MS SQL家的忠实用户了,2000的时候我是从一本2000宝典开始入门的,从2000到2005经历了很长时间,很多的用户至今还死死的守着2000,如果不是工程要求,估计我也不会主动换到2005,然而眼睛一眨,2008又出来了,哀叹,2005的功能我都没有摸透呢。
2008与2005的对比
1.慢,什么都慢,从恢复数据库,到导入数据 ......