Viewing 15 posts - 1,051 through 1,065 (of 3,957 total)
Jeff - I see now how you manage to keep your post count so high. By working over time on holidays looking for old threads! 😛
Interesting point about ISNULL...
December 1, 2013 at 5:33 pm
You can also combine CROSS APPLY with Table Row Constructors to do cool things like an UNPIVOT.
Refer to the first article in my signature links for more information.
November 28, 2013 at 5:43 pm
$w@t (11/27/2013)
Try this
declare @ColumnNameList VARCHAR(MAX)
SELECT @ColumnNameList = COALESCE(@ColumnNameList +',' ,'') + ColumnName
FROM
<<table name>>
select @ColumnNameList
While this works for...
November 28, 2013 at 5:41 pm
This is pretty simple to do with a pattern-based string splitter like the one in the 4th article in my signature links:
SELECT Item
FROM tmp_id
CROSS APPLY PatternSplitCM(Name, '[0-9]')
WHERE [Matched]=1;
If your names...
November 28, 2013 at 5:33 pm
Change the PROCEDURE definition:
create procedure sp_snapshot_create
(
@SS_Name varchar(100)
)
as
declare
@FileName_Datavarchar(50),
@FilePathvarchar(200),
@sqlvarchar(max),
@datevarchar(10);
Note that you should take a look at using sp_executesql instead of EXEC(@SQL) to avoid possible...
November 28, 2013 at 5:20 pm
You can expose pretty much any parameter you want regardless of position using a pattern-based string splitter like this:
WITH SampleData (ID, ConnectionString) AS
(
SELECT 1, 'server=SVR1;database=DB1;uid=user1;pwd=pass1;enlist=true'
...
November 28, 2013 at 5:15 pm
mickyT (11/27/2013)
Can I put this one up 🙂
select personid, goaldate, goalstatus,
row_number() over (partition by personid, goalstatus, g order by goaldate) * GoalStatus ConsecutiveGoals
from (
select personid, goaldate, goalstatus,
row_number() over (partition...
November 27, 2013 at 6:20 pm
ankit.gupta1 (10/14/2013)
T1 and T2.
T1 has 1 row as
name and age
T2 has 2 rows as
name, money1
name, money2
I use left outer join and get two rows in the resulting...
November 27, 2013 at 5:35 pm
Could you do something like this?
CREATE TYPE T AS TABLE (C1 INT, C2 INT);
GO
CREATE PROCEDURE SP1 (@T T READONLY)
AS BEGIN
-- Do your validations, etc.
...
November 27, 2013 at 5:26 pm
Try this. If you can figure out what it is doing, you should be able to make the method work for your case.
CREATE TYPE T AS TABLE (I INT);
GO
CREATE...
November 27, 2013 at 5:13 pm
hunchback (11/27/2013)
November 27, 2013 at 4:59 pm
hunchback (11/26/2013)
Calculate the running total of GoalStatus = 0 by PersonId ordered by GoalDate. Calculate...
November 26, 2013 at 8:55 pm
You can also do it with a Quirky Update (QU) but you'd need to add a PRIMARY KEY and an additional column to your #Goals table:
CREATE TABLE #Goals (
...
November 26, 2013 at 8:26 pm
csallen_01 (11/26/2013)
No, if the next record is GoalStatus=0 the consecutiveCount goes to 0. Then the next record where GoalStatus=1 the consecutivecount goes to 1.
This strikes me as inconsistent with...
November 26, 2013 at 7:08 pm
Viewing 15 posts - 1,051 through 1,065 (of 3,957 total)