Forum Replies Created

Viewing 15 posts - 166 through 180 (of 356 total)

  • RE: How to make range for date and count?

    Hi poratips,

    Sorry, I don't have much experience in using Database Mail since I don't use this feature at work.

    --Andrew

  • RE: Timestamp to Datetime

    Agree entirely with Jeff.

    My previous post was wrong on a couple of points and wouldn't even have fixed up the OPs problem as a temporary workaround. I've corrected my post,...

  • RE: Problem with Date formating

    You can convert this string format into a datetime if you are happy to use the following dates for the 4 quarters:

    Q1: YYYY-01-01

    Q2: YYYY-04-01

    Q3: YYYY-07-01

    Q4: YYYY-10-01

    DECLARE @dateString char(5)...

  • RE: Replace leading zeros

    Seems an odd requirement, but this is an alternative:

    SELECT SUBSTRING(Field1, 8, 8 - PATINDEX('%[1-9]%', REVERSE(Field1)))

    FROM (

    SELECT '05380101010000' AS Field1 UNION ALL

    SELECT '05380101020000' UNION...

  • RE: Timestamp to Datetime

    EDIT: Sorry this previous posting was wrong on a couple of aspects. I've fixed it up below.

    The timestamp data type aka rowversion (which is a much better name for it),...

  • RE: Find last occurence of a character within a string

    If you're looking to retrieve the filename from a path, then this seems to do the job:

    SELECT FieldA, COALESCE(RIGHT(FieldA, NULLIF(CHARINDEX('\', REVERSE(FieldA)) - 1, -1)), FieldA, '') AS Filename

    FROM (

    ...

  • RE: Knowledge sharing: Date conversion according to TimeZone

    +05:30 means 5 hours 30 minutes, not 5.30 hours

    I blame the Babylonians 😉

  • RE: UDF with Dynamic SQL Query

    1) You cannot use dynamic SQL from user-defined functions written in T-SQL.

    2) You could potentialy avoid the above restriction if this were a stored procedure instead of a UDF, but...

  • RE: Knowledge sharing: Date conversion according to TimeZone

    kruti (4/8/2009)


    Hey Flo/Paul,

    thanks guys for helping me.

    The problem in my code was, i was converting date with approx value in floating point terms. At last, we all come to...

  • RE: Reporting a single record for multiple occurrences spanning 3 days

    Here's the test data taken from your attachment:

    CREATE TABLE #FileData (

    File_ref int,

    tran_datetime datetime

    )

    INSERT #FileData (File_ref, tran_datetime)

    SELECT 324329, '20090406 10:47:00' UNION ALL

    SELECT 324329,...

  • RE: Help on Generating XML

    The T-SQL below queries your StoreRoleMapping table to generate the XML. You can specify the StoreRoleMappingID (?primary) column value of any row where the StoreRoleLevelID column value is 3 (Region),...

  • RE: Help on Generating XML

    If I wanted to display all stores under District1 only using StoreRoleMappingID 5, then it should display stores under StoreRoleMappingID 9 and 10.

    What XML do you want to be generated...

  • RE: Help on Generating XML

    James,

    Glad to be of assistance.

    Thanks for your feedback.

    --Andrew

  • RE: Help on Generating XML

    I've changed your table to include ID and ParentID columns, which allow the parent-child relationship of the rows to be properly defined. Note that this amended table still has the...

  • RE: Help on Generating XML

    SELECT 'Region1' AS Description,'NULL' AS StoreID,'NULL' AS CompanyID,0 AS Level UNION ALL

    SELECT 'District1','NULL','NULL','1' UNION ALL

    SELECT '111/12345','111','12345','2' UNION ALL

    SELECT '222/12345','222','12345','2' UNION ALL

    SELECT 'District2','NULL','NULL','1' UNION ALL

    SELECT '333/3456','333','3456','2'

    There's no way of determining...

Viewing 15 posts - 166 through 180 (of 356 total)