易截截图软件、单文件、免安装、纯绿色、仅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语句大全

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 ......

【Oracle】SQL优化的重要工具 AUTOTRACE

【AUTOTRACE】SQL优化的重要工具--AUTOTRACE
提到SQL优化,不能不提AUTOTRACE的强大功能。使用起来非常便捷,不过在是使用之前,需要做一些配置的工作。简要的描述一下这个过程,供没有使用过的朋友参考。
1.使用sys用户执行plustrce脚本
sys@ora10g> @?/sqlplus/admin/plustrce
sys@ora10g> drop role plustrace ......

SQL Server中存储过程与函数的区别

SQL Server用户自定义函数和存储过程有类似的功能,都可以创建捆绑SQL语句,存储在server中供以后使用。这样能够极大地提高工作效率,通过以下的各种做法可以减少编程所需的时间:
   1 重复使用编程代码,减少编程开发时间。
   2 隐藏SQL细节,把SQL繁琐的工作留给数据库开发人员,而程序开发员则集中处理高级编程 ......

Java调用SQL Server的存储过程详解

1使用不带参数的存储过程
  使用 JDBC 驱动程序调用不带参数的存储过程时,必须使用 call SQL 转义序列。不带参数的 call 转义序列的语法如下所示:
  
以下是引用片段:
{call procedure-name}
  作为实例,在 SQL Server 2005 AdventureWorks 示例数据库中创建以下存储过程:
  
以下是引用片段: ......

PL/SQL 001

在 Oracle 10g  中 
可以通过 http://localhost:5560/isqlplus 访问 isqlplus 
在 isqlplus 中 可以执行 plsql
set serveroutput on size 100000   // 打开 服务器的输出  on 后面是 缓存的大小 范围是  (2000 至 1000000)
begin
   dbms_output.put_line('hel ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号