Viewing 15 posts - 976 through 990 (of 3,489 total)
Use DelimitedSplit8K() and then specify the item# you want to return?
Jeff Moden wrote an article about splitting strings and included a UDF to do it. It returns (Value, Position) so...
April 18, 2019 at 12:21 am
Like this?
use tempdb;
GO
-- Now i want to order the KEY Column in products table
use tempdb;
GO
-- Now i want to order the KEY Column in products table
CREATE TABLE...
April 15, 2019 at 4:04 am
Can you post real table definitions (even partial)? It's impossible to answer your question with the current level of detail.
April 11, 2019 at 10:51 pm
Maybe this article will help.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
April 10, 2019 at 5:12 pm
Why not use Jeff Moden's DelimitedSplit8K? It returns an Item and the Item's ordinal position. Then you could just insert that into your final table.
Got any sample data for us...
April 9, 2019 at 6:22 pm
If you grant users execute rights on the schema, then they can access the objects inside it. What are you trying to accomplish by doing this?
April 7, 2019 at 9:55 pm
Grrr… Can't I edit my posts anymore?
I think the problem I'm having is that I can't get SQL Server to do a case-sensitive search. Not sure what I'm doing wrong.
SELECT...
April 2, 2019 at 6:48 am
Did you try using LAG()?
April 2, 2019 at 5:44 am
Another weird thing... What's up with the way this version of the forum software counts responses? It looks like it's counting messages in the thread and not responses. In the...
April 2, 2019 at 4:07 am
Is it possible to collapse some of the forums like you could on the old version of the website? Super handy to minimize the stuff I'm not currently interested in.
(I...
April 2, 2019 at 3:12 am
March 29, 2019 at 10:56 am
First, I can't really read your pictures. Second, I have no scenario or description of what's going on to compare it to, so sure, it's great. They both are. Knock...
March 28, 2019 at 10:45 pm
This will split the data:SELECT col, ds.ItemNumber, ds.Item
FROM #Table t
CROSS APPLY Utilities.dbo.DelimitedSplit8K(col,'-') ds
Then you would have to pivot it. This is most...
March 28, 2019 at 9:41 am
Do you mean like this?
SELECT *
FROM (
SELECT soh.CustomerID
, soh.OrderDate
, LAG(soh.OrderDate,1) OVER (PARTITION BY soh.CustomerID ORDER BY soh.OrderDate) AS PrevSale
FROM Sales.SalesOrderHeader soh
March 27, 2019 at 6:31 pm
You can sort inside the partition. (Using AdventureWorks2008R2)
SELECT soh.CustomerID
, soh.OrderDate
, LAG(soh.OrderDate,1) OVER (PARTITION BY soh.CustomerID ORDER BY soh.OrderDate) AS PrevSale
FROM Sales.SalesOrderHeader soh
ORDER...
March 27, 2019 at 5:21 pm
Viewing 15 posts - 976 through 990 (of 3,489 total)