• 如何将 com与 out分开,使用 lo
参考:
我有像4,3,5,2,5,9人一样的护卫。
如果想在第3号 com子之后再穿透镜而不使用 lo。
• 如何将 com与 out分开,使用 lo
参考:
我有像4,3,5,2,5,9人一样的护卫。
如果想在第3号 com子之后再穿透镜而不使用 lo。
DECLARE @str varchar(MAX)= 001,002,03,0004,05,6,07
,@separator char(1)= ,
,@n int = 3;
WITH str_nums ( id, n1, n2 )
AS
(
SELECT CAST(1 as int) as id, CAST(0 as bigint) as n1, CHARINDEX(@separator, @str+@separator) as n2
UNION ALL
SELECT id + 1, n2 as n1, CHARINDEX(@separator, @str+@separator, n2+1) as n2
FROM str_nums
WHERE n2<len(@str)
)
SELECT SUBSTRING(@str, n1+1, n2-n1-1) as n_str
FROM str_nums
WHERE id = @n
GO
如果我们知道
DECLARE @S varchar(max),
@Split char(1),
@X xml
SELECT @S = 1,2,3,4,5 ,
@Split = ,
SELECT @X = CONVERT(xml, <root><s> + REPLACE(@S,@Split, </s><s> ) + </s></root> )
SELECT [Value] = T.c.value( . , varchar(20) )
FROM @X.nodes( /root/s ) T(c)
然后,只有第三位(或你想要的哪位)才能证明你可以使用ROW_NUMBER
的解决方案,以取代你所关心的一行。
EDIT:根据该评论中的问题,这里提出了恢复第三层的解决办法。 由于你没有任何基于数据的命令,你必须撤销<编码>ROW_NUMBER。 通常,它会赢得铁 let。 由打印成,但CASE
报表随附。 将<条码>WHERE iq.Ordinal = 3改为你想要检索的座右铭:
DECLARE @S varchar(max),
@Split char(1),
@X xml
SELECT @S = 1,2,3,4,5 ,
@Split = ,
SELECT @X = CONVERT(xml, <root><s> + REPLACE(@S,@Split, </s><s> ) + </s></root> )
SELECT TOP 1 Value
FROM
(
SELECT [Value] = T.c.value( . , varchar(20) ),
ROW_NUMBER() OVER (ORDER BY
CASE
WHEN T.c.value( . , varchar(20) ) = 0
THEN 0
ELSE 0
END ASC) AS Ordinal
FROM @X.nodes( /root/s ) T(c)
) iq
WHERE iq.Ordinal = 3
I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...
In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
Is it possible to use the sqlcmd command to dump table structure the way it can be done with mysqldump?
Hi I have the following SP, however when I use LINQ to SQL it generates 2 multiple recordsets. For my sanity I am trying to fathom out what it is in the stored procedure that is doing this and would ...
I want to create a table in MS SQL Server 2005 to record details of certain system operations. As you can see from the table design below, every column apart from Details is is non nullable. CREATE ...
I love the new DATE datatype in SQL Server 2008, but when I compare a DATE field to a DATETIME field on a linked server (SQL 2005, in this case), like this: DECLARE @MyDate DATE SET @MyDate = CONVERT(...
How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8