Forum Replies Created

Viewing 15 posts - 1,441 through 1,455 (of 2,894 total)

  • RE: How to bring all Ids of my table in Order

    1. the name of a table is a collective or plural noun because it models a set of entities. You just told us that your database has only one person!

    Personally...

  • RE: XML Query

    SELECT

    T2.Line.value('(../../../../FirstName/text())[1]','VARCHAR(30)') as FirstName,

    T2.Line.value('(../../../../LastName/text())[1]','VARCHAR(30)') as LastName,

    T2.Line.value('(../../InvoiceNumber/text())[1]','VARCHAR(30)') as InvoiceNumber,

    T2.Line.value('(../../InvoiceAmount/text())[1]','INT') as InvoiceAmount,

    CAST(T2.Line.value('(../../InvoiceDate/text())[1]','VARCHAR(30)') AS DATETIME) as InvoiceDate,

    T2.Line.value('(LineNumber/text())[1]','INT') as LineNumber,

    T2.Line.value('(ChargeDescription/text())[1]','VARCHAR(30)') as ChargeDescription,

    T2.Line.value('(LineAmount/text())[1]','INT') as LineAmount

    FROM #xml_data

    CROSS APPLY data.nodes('/Customer/InvoiceCollection/Invoice/InvoiceLineCollection/InvoiceLine') as T2(Line)

    Please next time provide DDL...

  • RE: go back the past 12 months from today

    how can I get the month and year of today ...

    SELECT YEAR(GETDATE()), MONTH(GETDATE()), DATENAME(MONTH,GETDATE())

    ... and go back the past 12 months from the year month that is...

  • RE: Query help

    You can try this:

    WITH C

    AS

    (

    SELECT YEAR(OrderDate) ...

  • RE: Modify the output

    What exact output do you expect from setup provided?

  • RE: only importing one row at a time with sql loader statement

    Try some MYSQL forum...

  • RE: call executable with xp_cmdshell from procedure

    What is supposed to happen? What your expected result from executable?

  • RE: Working with dates

    I need 8 weeks * 7 days numbers (56), so I can go back up to 56 days (8 weeks) and find last 8 fridays.

    This one can be replaced with...

  • RE: Odd Behavior of update query

    kapfundestanley (5/31/2012)


    I executed this query:

    update table2

    set id=(select max(id) from table1)

    where id=0.

    It indicates it executed,but on checking no update happened.Out of curiosity what could be the cause of this?I repeated...

  • RE: correct the code

    You do something very stupid here:

    SELECT

    '12/31/2011' as CloseDate,

    '0' as CostBasis,

    '09/30/2010' as OpenDate,

    '1' as PortfolioBaseIDOrder,

    '0' as Quantity,

    '0' as RealizedGainLoss

    from dbo.fRealizedGainLoss(@ReportData) r

    If the result of dbo.fRealizedGainLoss(@ReportData) is 5 rows, you will get...

  • RE: Working with dates

    DECLARE @dt DATETIME

    SET @dt = GETDATE()

    ;WITH rns56

    AS

    (

    SELECT TOP 56 (ROW_NUMBER() OVER (ORDER BY c) - 1) * -1 rn

    FROM (SELECT 1...

  • RE: NOLOCK processing vs normal; Does NOLOCK do less processing?

    Effect of NOLOCK is the same as SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

    It just individually applied to the table and query, while setting isolation level makes it for every...

  • RE: NOLOCK processing vs normal; Does NOLOCK do less processing?

    The only place I ever used in a production code was loading data warehouse, where full control of data modifications was guaranteed: nothing could possibly make any change in a...

  • RE: query to delete the records for 5 week older data

    Jay Pete (5/31/2012)


    anthony.green (5/31/2012)


    DELETE FROM test1 WHERE col1 <= DATEADD(WEEK,-5,GETDATE())

    Will delete anything where col1 is 2012-04-26 (based on today) or less

    Thanks Anthony.It Works.

    Can we use DATEDIFF function?

    Yes you can, but...

  • RE: Extract Data from SQL table ( single record ) to text file - ( multiple lines )

    "How to" what?

    Use SSIS? - BoL would be your first point

    Use BCP? - BoL would be your first point

    Writing the query? - Read this first: http://www.sqlservercentral.com/articles/Best+Practices/61537/ and...

Viewing 15 posts - 1,441 through 1,455 (of 2,894 total)