Forum Replies Created

Viewing 15 posts - 136 through 150 (of 240 total)

  • RE: converting rows into columns (urgent)

    Try this:

    declare @Items table(ItemID int, Location char(3), Quantity int)

    insert @Items values(1234,'mux',25)

    insert @Items values(1234,'lux',30)

    insert @Items values(1234,'abc',21)

    insert @Items values(1234,'cbe',15)

    insert @Items values(5647,'mux',1)

    insert @Items values(5647,'kuc',3)

    insert @Items values(5647,'jud',6)

    select mux.ItemID

    ,mux.Quantity as 'mux'

    ,lux.Quantity as 'lux'

    ,abc.Quantity as 'abc'

    ,cbe.Quantity...

  • RE: converting rows into columns (urgent)

    Try this:

    declare @Items table(ItemID int, Location char(3), Quantity int)

    insert @Items values(1234,'mux',25)

    insert @Items values(1234,'lux',30)

    insert @Items values(1234,'abc',21)

    insert @Items values(1234,'cbe',15)

    insert @Items values(5647,'mux',1)

    insert @Items values(5647,'kuc',3)

    insert @Items values(5647,'jud',6)

    select mux.ItemID

    ,mux.Quantity as 'mux'

    ,lux.Quantity as 'lux'

    ,abc.Quantity as 'abc'

    ,cbe.Quantity...

  • RE: Print Dates between Min & Max Dates

    Personally, I always use a permanent copy of the "Numbers" table too.  It is one of the first things that I install on each SQL server.  I was just including a...

  • RE: The dreaded "unable to begin a distributed transaction"

    Is MS DTC running on Server 2?

  • RE: changing varchar datatype to text

    I am not clear but in each of the 10 2000 character fields, do you intend on string a comma delimited list of emails?

    This should be further normalized into a...

  • RE: Print Dates between Min & Max Dates

    I may have misread you problem and realized that you are using European style dates and what you really want is the dates between 01 Jan 2005 and 05 Jan 2005.

    This...

  • RE: Print Dates between Min & Max Dates

    Won't this just return all dates between the two earliest and latest rows in the database, including dupclicates?

    This would work better:

    SELECT DISTINCT MyDateField

    FROM MyTableName

    WHERE MyDateField > @MinDateField

    AND MyDateField < @MaxDateField

    But,...

  • RE: Execute a large text string

    This is the method that I've used to do this. 

    Using a cursor concatenate the varchar() field won't work because of the 8000 character limit on varchar fields.

    Any method involving...

  • RE: blobs....

    Are you sure that the problem is on the SQL server and not the client application?

  • RE: dynamic SQL

    Its acceptable to use when it needs to be but there are some extra percautions that need to be taken to ensure security.

    When using arguments that are passed in they...

  • RE: Summarizing Question

    It is a good idea not to try and do data layout in a stored procedure or SQL statement.  You should return the data as a set and have some...

  • RE: how to find and fill date

    set @i = ID = @i + 1, read from right to left increments the value of the local variable @1, assigns this value to the ID column of the...

  • RE: Delete Based On List Of Values in Stored Procedure

    I usually find that the use of an IN is slower than doing an inner join to the function or table.

  • RE: Returning entire record from stored procedure

    Actually, in this case the default size is 1.

    CREATE PROCEDURE dbo.GET_USER_DETAIL (@lan_id varchar)

    AS

    print '<' + @lan_id + '>'

    GO

    exec GET_USER_DETAIL 'jeff'

    The output is <j>

  • RE: Delete Based On List Of Values in Stored Procedure

    Antares second option is what I frequently use.  Here is a sample

     

    DECLARE @paramlist NVARCHAR(100)

    SET @paramlist = '7|2|8|65' -- test data; string can be any number of indices

    SET @paramlist = '|'...

Viewing 15 posts - 136 through 150 (of 240 total)