Forum Replies Created

Viewing 15 posts - 2,071 through 2,085 (of 2,462 total)

  • RE: Alternative to SSRS...

    I am only familiar with SSRS (and another tool I will mention in a moment) but have seen others have luck with Cognos and Tableau for OLTP and OLAP environments....

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SSRS: optional parameter, grouper, column display.... is it possible

    mario17 (10/28/2013)


    Hi,

    I'm trying to make one of parameter and grouper in my SQL optional, is it possible, for now I'm thinking:

    1. in SSRS make parameter UseParam1 = Y/N

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Inline Query

    manickavasagam.g (10/25/2013)


    declare @BDate datetime = '01 jan 1990'

    select DATEDIFF(yy,@BDate, getdate()) as AgeInYears, DATEDIFF(mm,@BDate, getdate()) as AgeInMonths, DATEDIFF(WW,@BDate, getdate()) as AgeInWeeks

    Take a look at what happens when you change @BDate to...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Inline Query

    todd.ayers (10/24/2013)


    How could I write a sql statement to where I could get an age in one field based off typing a date in another field?

    I am trying to get...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Inline Query

    Bill Talada (10/24/2013)


    declare @t table ( birthdate date, age as datediff(year,birthdate,getdate()) ) ;

    insert into @t (birthdate) values ('20000101')

    select * from @t

    I think this will do the trick to get someone's...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: How to process package even one task failed but allow other tasks to process

    All you need to do is change precedence constraint from Success to Completion.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: search text within for string

    I wanted to include the XML technique for this because Text1,2 & 3 all look like truncated XML (are those the actual values or did you truncate the values for...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: spliting nested string

    Ok, I know this thread is old but if PatternSplitCM[/url] was available when this was posted you could do this:

    DECLARE @string varchar(100)='1:1,3,5,7,4:56,43,58,5:34,67r,234';

    WITH prep1 AS

    (

    SELECT x.ItemNumber,

    ROW_NUMBER() OVER...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SQL Table

    From your example code it's hard to determine what you are changing the table names to. Below is a script that works without any cursors or loops to rename tables...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Extracting Numbers from String

    I misunderstood the OP and updated my function to do what I think you are trying to do (it was originally searching for an id instead of six consecutive integers....

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Extracting Numbers from String

    Edit: misinderstood the requirement. Updated my function accordingly...

    With the DelimitedSplit8K[/url] splitter function you could create an inline Table Valued function like this:

    CREATE FUNCTION dbo.string_to_table(@string varchar(8000))

    RETURNS TABLE

    AS

    RETURN

    (

    SELECTLEFT(item, CHARINDEX('...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Alternative to replace the cursor

    There are a number of ways to do this without a cursor. Here's a great article:

    Concatenating Row Values in Transact-SQL[/url]

    You could use the FOR XML PATH method and rewrite...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: How to delete all rows if one row meets a criteria

    mittensonmaui (10/22/2013)


    Hi all I am running a query where I check medical orders on an encounter there can be 1000's of orders and if one of them matches a specific...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Whether order of rows will be changed when its selected?

    Just to add to what Koen said...

    The only way to guarantee that rows are returned in a specific order is when ORDER BY is used.

    It's also worth noting...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: How to execute stored proc iin a loop for a date range

    sqlblue (10/17/2013)


    What is the best way for me to call this

    stored proc in batches?

    Below is an example of what I think you are trying to do. This proc will keep...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 2,071 through 2,085 (of 2,462 total)