Forum Replies Created

Viewing 15 posts - 781 through 795 (of 1,082 total)

  • RE: how to update a rows of data using a function in a Stored Procedure

    Is that case statment solution not working???

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: SUM function neglects the value with exponential characters

    How are you getting the data in to the table with the expo values ?

    Could you give me an example of an insert line of data thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: how to update a rows of data using a function in a Stored Procedure

    HI There,

    Will this not help you?

    UPDATE Item

    SET BandDate = CASE WHEN dbo.fnConst_GetModel(ItemId) = 1 THEN NULL ELSE getdate() END

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: SUM function neglects the value with exponential characters

    HI Kisha,

    Please could you provide us with some sample data, and datatype definitions?

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Insert data into column from a stored procedure

    Hi,

    I'm not sure that it is possible with this procedure.

    Because of this error.

    Msg 8164, Level 16, State 1, Procedure sp_get_composite_job_info, Line 58

    An INSERT EXEC statement cannot be nested.

    Which isn't because...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Create new Statistics

    Thanks Gail 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: eed to get previous quarter date from current date

    Thats the one,

    since my last post I been trying to find a way to do it without doing a CHAR cast.

    Well done Jeff thats awesome 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: eed to get previous quarter date from current date

    Nice solution Jack, too me a bit to work it out but I ended up with the same solution 😉

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Insert data into column from a stored procedure

    Hi Vampire.

    What you have said above is not 100% correct.

    You can infact insert rows into a table from a SP as mentioned.

    For example:

    [Code]

    CREATE PROCEDURE dbo.MyProc

    AS

    SET NOCOUNT ON

    SELECT

    1 as...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Usage of "Tally Table"

    Hi Karthik,

    The main difference between your query and mine, other than the fact that mine seems run much faster is the following.

    I can control exactly how I want data split...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: How to find top parentid in a table where the table is like a tree structure

    HI There,

    I'm not sure how if you have an input of 70 you get a result of 10,30,40,50,60,70,80,90

    Please could you explain your input and out values again?

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Usage of "Tally Table"

    Hi ,

    Firstly yes the first query actaully also runs in ms on my server.

    so I increased the volume to 10000

    This took around 3.5secs

    Where as the below code took a 1sec...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Rearrange rows into columns

    Hi,

    Here is a section of Code that will create a dynamic pivot:

    I have used a UNION select to insert my data, but you will need to replace this with your...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: How to identify the position of the nth occurance of character in a string

    HI all,

    A Good idea would be to change the function supplied to use the Tally table instead of a loop.

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Adding Columns together from Rows

    HI All,

    OK I managed to find a solution.

    If someone can find a better one please let me know thanks:

    ;WITH myCTE ([id],[SECTION],[Total],[col1])

    AS

    (

    SELECT

    [id],

    SECTION,

    Total,

    CAST(col1 as VARCHAR(10))as col1

    FROM @tbl a

    UNION ALL

    SELECT

    a.[id],

    a.SECTION,

    a.Total,

    CAST(a.col1 +...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 15 posts - 781 through 795 (of 1,082 total)