Forum Replies Created

Viewing 15 posts - 7,396 through 7,410 (of 8,731 total)

  • RE: Procedure with default parameters

    I'm not sure if you're trying to add defaults to your report parameters or your SP parameters.

    In case that you want defaults to your SP parameters, you have two options...

  • RE: LIKE - finding ']' or '.' in data

    You could use an ESCAPE character.

    DECLARE @Table1 TABLE

    (

    Column1 VARCHAR(32) NOT NULL PRIMARY KEY

    );

    INSERT @Table1(Column1)

    VALUES

    ('abcdef123'),

    ('abcdef]123'),

    ('abcdef].123'),

    ('abcdef)123'),

    ...

  • RE: Order My Data

    Victor Kirkpatrick (12/2/2013)


    This question should be deleted before people go away with a very very very bad assumption: I can throw a clustered index on a column and always expect...

  • RE: now.dateadd(d, -1) at 7AM

    Are you using reporting services or T-SQL code?

    For T-SQL, you can use this formula:

    DATEADD(hour, 7, DATEADD( Day, DATEDIFF(day, 0, GETDATE())-1,0))

  • RE: Hyphen vs. Underscore in LIKE clause? why they are the same ??

    Just to make it clear for someone else.

    The underscore acts as a single character wildcard with the LIKE operator. To ensure you get an underscore, you need to put it...

  • RE: formatting varchar as percentage

    What would happen with a value like 8.352?

  • RE: Difference between two dates ignoring the year

    Now the question is, do you understand how this works?

  • RE: Like statement

    With piet's query you might loose rows if your dates have milliseconds after 13:49 and with dogramone's you might include dates on 13:50.

    SELECT *

    FROM #Test

    WHERE myDatetime >= '2013-11-26 13:49'

    AND myDatetime...

  • RE: Like statement

    That's because the column DTStamp is being implicitly converted to char with a different format.

    Here are two options but might not be the best ones.

    CREATE TABLE #Test( myDatetime datetime)

    INSERT #Test...

  • RE: SQL Server Database Administrator next Position or Role

    For a SQL DBA, you might want to look into becoming a Data Architech or follow a path to get more into administration and less into technology but that would...

  • RE: Need a 2nd opinion on a query

    He's trying to count the events with Recordtype = 'promo' that have a corresponding event with Recordtype = 'event'. I don't know why, that's up to your needs.

    The following might...

  • RE: SQL Syntax Question

    Here's an example of a parametrized dynamic query using sp_executesql. Note that I'm using the DelimitedSplitN4K to split the values because you can't use IN for a single variable with...

  • RE: SQL Syntax Question

    You might want to change your @sql definition to something like the following:

    set @sql = 'SELECT Company_NO,

    '''' as CompanyName, --Added extra quote marks

    CASE isNull(post_date, 0)

    WHEN 0 THEN DATEPART(yyyy,...

  • RE: How can I solve Null value is eliminated by an aggregate or other SET operation?

    Lowell (11/26/2013)


    hunchback (11/26/2013)


    There is no harm by having both expressions but having "LastDate <> '19000101'" is enough to cover both cases "is not NULL and is diff from '19000101'".

    WHERE ...

    ...

  • RE: Difference between two dates ignoring the year

    Here are 2 options to perform your calculation:

    SELECT ABS(DATEPART( dayofyear, CutoffDate) - DATEPART( dayofyear, GETDATE())),

    ABS(DATEDIFF( day, DATEADD( year, DATEDIFF( year, CutOffDate, GETDATE()), CutOffDate), GETDATE()))

    FROM #Temp

Viewing 15 posts - 7,396 through 7,410 (of 8,731 total)