Forum Replies Created

Viewing 15 posts - 2,221 through 2,235 (of 3,544 total)

  • RE: Is it possible to create a temp table with dynamic columns?

    Try this

    DECLARE @Mode varchar(10), @StartDate datetime, @sql varchar(4000)

    SET @Mode = 'Weekly'

    SET @StartDate = '2005/08/01'

    IF @Mode = 'Weekly'

      BEGIN

      SET @sql = 'ALTER TABLE #temp ADD...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Strange behaviour or expected behaviour with convert and left?

    quoteSo why does SQL Server 2000 gives 'Aug 2 200' back when I do a left 10 from...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: problems with order by/case statements and distinct

    use group by instead, eg

    select arrangements.description,arrangements.number_sql as arrno,[col1],col[2],[coln]

    from events inner join arrangements on events.arrangement_number = arrangements.number_sql

    where events.room_number in (61,59, 50)

    and events.performance = -1

    group by arrangements.description,arrangements.number_sql as arrno,[col1],col[2],[coln]

    order by

    case lower(@@Orderby)

    when...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: OPENQUERY and dynamic SQL

    No it is not a typo (the highlight and underline is the forum's doing)

    Look up syntax in BOL

    sp_executesql [@stmt =] stmt

    [

        {, [@params =] N'@parameter_name  data_type [,...n]' }...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: OPENQUERY and dynamic SQL

    CREATE PROCEDURE [dbo].[linked_Server_Test]

      @ORDERID bigint, @errorcode char(2) OUTPUT

    DECLARE @Accref varchar(50), @sql nvarchar(4000)

    SET @sql ='SELECT @Accref = CustomerID

    FROM OPENQUERY(LINKEDSERVERNAME,

    ''

    SELECT CustomerID

    FROM dbo.SS_ORDER

    WHERE O.OrderID = ' +...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query Again - Complex

    Don't forget modest as well 

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query Again - Complex

    is that another vote for sushila then 

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: sorting a column

    quoteI am surprised that I am falling that much behind

    Not as much as I

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: sorting a column

    quoteI suppose you are thinking of something like

    Yep!

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query Again - Complex

    Have you defined the parameters as output?

    When you execute this in QA do you get any results?

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query Again - Complex

    No. Just make sure they are the same size as the source columns in the Bets table.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query Again - Complex

    In that case change the code to

    DELETE FROM TABLE MatchingBets

    INSERT INTO INTO MatchingBets

    (BetID,USERID,BETTYPE,Matches,Mystery)

    SELECT BetID,USERID,BETTYPE,0,0

    FROM Bets

    and make sure the table structure contains the following columns in the correct order BetID,USERID,BETTYPE,Matches,Mystery

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query Again - Complex

    Are you using a permanent or temp table?

    If you are using a temp table you will get this error in QA if you do not drop the temp table when...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: sorting a column

    Yes a built in function would be nice, I bet it would use the equivalent of CHARINDEX & SUBSTRING as PARSENAME probably does

    Performance...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: sorting a column

    quote

    And even though it may not be useful to the original problem, I think the following is an...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 2,221 through 2,235 (of 3,544 total)