Forum Replies Created

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

  • RE: Cursor only grab first record and repeats it always

    Yes like this:

    DECLARE name CURSOR ...

    FOR SELECT ....

    OPEN name

    FETCH NEXT FROM name INTO @var

    WHILE @@FETCH_STATUS = 0

    BEGIN

    ... Do some work

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Cursor only grab first record and repeats it always

    You should move your second

    FETCH Next From MPDV INTO @QId,@MPDV,@answer,@dtLogged,@strRemarks,@strLogged

    inside of loop

    The same is for

    FETCH Next From Pers INTO @Personnel

    I guess it's cut-&-paste one 😉

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Data type for storing script files

    Script file is the text isn't it?

    So nvarchar(max) is the best for this. There is an option to store nibanry data in ntext, text ot image datatype, but it's...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Single row to multiple columns

    SQL2000?

    Good Luck!

    Ok, you will need to use temp table:

    SELECT IDENTITY(int,1,1) idn,

    0 AS RN,

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Single row to multiple columns

    You are posting to fast 😀

    Check the previous post!

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Data type for storing script files

    Lavanyasri (8/17/2011)


    HI ,

    I want store some script files in my table . Which data type i have to use to store script files .

    Regards,

    Lavanya sri

    If your scripts...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Single row to multiple columns

    karthikeyan-444867 (8/17/2011)


    I just came to know i need to implement the same against a table data.

    CREATE TABLE W

    (

    ID INT,

    val varchar(255)

    )

    insert into W

    select 100, 'D,20.5%,10.25%,A account is being linked to B...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Single row to multiple columns

    Not bad, but try to set your input variable to:

    select @_sPlatform = 'D,20987987.5%,A account is being linked to B account'

    Sample I've gave you would work;-)

    However, using Tally method would...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Declare statement inside cursor

    sharath.chalamgari (8/17/2011)


    but still the statement in the link you provided says that

    "After declaration, all variables are initialized as NULL, unless a value is provided as part of the declaration."

    so when...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: null for parent data

    It's duplicated thread from TSQL(2005) forum...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Delete Everything (not really)

    As you ingoring the forum advise to present your question in a polite way, I can only show you a generic sample:

    DELETE fk

    FROM TableWithFK fk

    JOIN TableWithPK...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Declare statement inside cursor

    If your read: http://msdn.microsoft.com/en-us/library/ms188927.aspx

    You will find that the scope of a local variable is the batch in which it is declared (you are not in c# or vb :-)).

    That's...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: syntax near a subquery

    Jason-299789 (8/17/2011)


    I've never come across this syntax in 10 years of T-SQL programing, but its good to see it, and the explination for it.

    I think 98% of people would...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Single row to multiple columns

    Yep, as simple as this:

    declare @_sP varchar(1024)

    select @_sP = 'D,20.5%,10.25%,A account is being linked to B account'

    declare @cA varchar(1024),@cB varchar(1024),@cC varchar(1024),@cD varchar(1024),@p int

    SET @cA=@_sP

    SET @p=CHARINDEX(',',@cA); IF @p>1 SELECT @cB=SUBSTRING(@cA,@p+1,1024),...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Single row to multiple columns

    If you are splitting just one single value, anything would do!

    You can use just SET operators to check next position of comma and to get one value after another.

    If you...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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