Forum Replies Created

Viewing 15 posts - 181 through 195 (of 430 total)

  • RE: Average Sold Per Month Query

    Is you'r welcomed forum standard now!!!! Thanks to noel.

     

    Regards,
    gova

  • RE: Average Sold Per Month Query

    I was in a hurry to beat you and lost again.

    Regards,
    gova

  • RE: Average Sold Per Month Query

    SELECT DATEPART(YEAR, SaleDate) SaleYear, Product, AVG(SaleQty)/12 AvgSalesPerMonth

    FROM

     orderdetail

    GROUP BY DATEPART(YEAR, SaleDate), Product

    Regards,
    gova

  • RE: Update problem

    Stupid Answer.

    Write a trigger to take care of that.

    Remi as mentioned in your first answer the design is not correct. There is no need...

    Regards,
    gova

  • RE: Update problem

    Back to square

    Regards,
    gova

  • RE: hardcoded into cursor, help plz

    Provide

    Schema, Sample Data, Required Results to help us to help you. I don't undersatnd completely what is needed.

    Regards,
    gova

  • RE: Running total

    I assume the data provided is with little error. See the corrected data and the solution

    SET NOCOUNT ON

    SET DATEFORMAT MDY

    create table #tblTempRetros(DateOpe datetime, Stock int, Subscriber int, Amount int)

    insert into...

    Regards,
    gova

  • RE: Datetime Query

    SELECT *

    FROM

            UploadData U

    JOIN

            ServerError S

    ON

            S.ErrorDate BETWEEN DATEADD(SECOND, 5, U.UploadTime)  AND DATEADD(SECOND, 300, U.UploadTime)

     

    I would have to say this will fetch morethan one error for an upload if two...

    Regards,
    gova

  • RE: iif(isempty(fieldName), 0, fieldName) not working

    IIF is VB function

     For T-SQL u can use

    CASE WHEN fieldName IS NULL THEN 0 ELSE fieldName END

    or

    ISNULL(fieldName, 0)

    or

    COALESCE(fieldName, 0)

     

    For your case it can be

    CASE WHEN COALESCE(FieldName, '') = ''...

    Regards,
    gova

  • RE: Join SQL needed to Update column

    Try this no cursor or loop

     

    UPDATE EC_OIT

    SET

     OrderItemID = EC_M.OrderID

    FROM

     EC_OrderItemTaxes EC_OIT

    JOIN

     (

     SELECT Match.[ID] TaxID, EC_OI.[ID] OrderID

     FROM

      EC_OrderItems EC_OI

     LEFT JOIN

      (

      SELECT IT.[ID], OI.OrderID

      FROM

       EC_OrderItemTaxes IT

      JOIN

       EC_OrderItems OI

      ON

       IT.OrderItemID = OI.[ID]) Match

     ON

      EC_OI.OrderID = Match.OrderID

     WHERE

      EC_OI.GlobalProductID <> 201) EC_M

    ON

     EC_OIT.[ID] = EC_M.[TaxID]  

    Regards,
    gova

  • RE: text More than 8000 chracters?

    May be this needs another topic. I am just wondering since the row size is 8060. What is the point in having a column with 8000 unless it is a...

    Regards,
    gova

  • RE: Left outer Query optimization

    Yes yes yes

    I have been doing this for zillion times. I need a coffee. Sorry for the confusion.

    My mind was thinking like below even after Vasc mentioned

     [Baseball65K50].[Col007] =  [Baseball65K24].[Col005] AND

     [Baseball65K50].[Col007] IS...

    Regards,
    gova

  • RE: changing data type

    Enterprise Manager will use a sytax like

    BEGIN TRANSACTION

    CREATE TABLE dbo.Tmp_MyTableName

     (

     MyTableName numeric(38, 16) NOT NULL)  ON [PRIMARY]

    GO

    IF EXISTS(SELECT * FROM dbo.MyTableName)

      EXEC('INSERT INTO dbo.Tmp_MyTableName (MyFieldName)

      SELECT CONVERT(numeric(38, 16), MyFieldName) FROM dbo.MyTableName TABLOCKX')

    GO

    DROP...

    Regards,
    gova

  • RE: Join SQL needed to Update column

    Do you mind posting the schema and sample data. There must be a way to do this without a cursor.

    Regards,
    gova

  • RE: Left outer Query optimization

    Vasc What I mean was that does't mean any thing. Synatax is correct and the join will not add any thing. It is as good as not having that join.

    Regards,
    gova

Viewing 15 posts - 181 through 195 (of 430 total)