Forum Replies Created

Viewing 15 posts - 151 through 165 (of 2,006 total)

  • RE: Must declare the scalar variable - Which is already declared

    You've used your variable in a different context to where it is defined.

    Try: -

    set @SQL1 = ' Insert into [dbo].[sapINV1]

    (DocEntry,

    Dscription,

    Currency,

    LineTotal,

    AcctCode,

    OcrCode,

    [Source]

    )

    select

    DocEntry,

    Description,

    Currency,

    LineTotal,

    AcctCode,

    OcrCode,

    '+CHAR(39)+@dbname+CHAR(39)+'

    from ' + @dbpath1

    set @dbpath2 = '[TBX-APP01].' + @dbname...

  • RE: How to Identify name starting with a specific letter without using like operator?

    Could do something odd like this: -

    WHERE Names = STUFF(Names,1,1,'A')

    That'd tell you if the "Names" started with an A.

  • RE: SQL Server Puzzling Performance

    From what I can tell after a quick look, your issue is that with the lower memory setting SQL Server decides to do a hash match, whereas with more memory...

  • RE: Modify XML in a field

    sharky (10/24/2013)


    Hi Hi Guys,

    The following is a Sample OF an XML field I want TO Modify:

    DECLARE @TestTAb AS TABLE(ID INT IDENTITY PRIMARY KEY, XMLText XML)

    INSERT INTO @TestTAb(XMLText) VALUES(

    '

    <main>

    ...

  • RE: wHICH IS BEST TO USE tRUNCATE OR dROP

    Rakesh.Chaudhary (10/24/2013)


    Hi,

    I am using Drop and create table in Loop because of results I want to achieve using loop. But my question is

    Is this better to use Truncate table...

  • RE: Count by name in string

    kiran.rajenimbalkar (10/24/2013)


    Hi Expert,

    thanks its worked but that was very complex.

    cant we do directly with using that tmp table?

    we need count of that name coulmn values

    Everything is complicated to someone that...

  • RE: Count by name in string

    kiran.rajenimbalkar (10/24/2013)


    what is [DelimitedSplit8K] in your sql ?

    Did you just copy and paste without reading what I wrote? Let me show you the relevant section that I'm talking about. ....

  • RE: Count by name in string

    Not exactly sure what you're trying to do. Here's my stab in the dark: -

    SELECT ID, NAME, COUNT(*) AS [COUNT]

    FROM tmp

    CROSS APPLY [dbo].[DelimitedSplit8K](NAME,' ')

    WHERE Item LIKE '%[[]%]%'

    GROUP BY ID, NAME

    ORDER...

  • RE: How can I get the average number of unique patients per month from a table?

    NineIron (10/23/2013)


    I'm using 2008. How do I change the compatibility? What do I change it to?

    SELECT compatibility_level, name

    FROM sys.databases;

    Execute the above. The database that you're working on will have a...

  • RE: How many of you came in to this via the accidental route?

    Beatrix Kiddo (10/23/2013)


    The job adverts all want absolutely everything, INCLUDING excellent T-SQL. I don't have a lot of my scripts memorised, but I know what they do and when to...

  • RE: Creating a Hierarchy

    ramos.ferdinand (10/17/2013)


    dwain.c it works!!!!!! :Wow:

    cadavre i would really appreciate it if you can walk me through on your query. the stuff and xml path are all new to me.

    Thanks...

  • RE: How can I get the average number of unique patients per month from a table?

    NineIron (10/23/2013)


    Could you tell me why I am getting the following errors?

    Msg 139, Level 15, State 1, Line 0

    Cannot assign a default value to a local variable.

    Msg 137, Level 15,...

  • RE: Selecting the Row with the MAX(DateStarted)

    Don't know if it's any better, but an alternative is: -

    SELECT DateStarted, RowID, ProductID

    FROM (SELECT DateStarted, RowID, ProductID,

    MAX(DateStarted) OVER(PARTITION BY ProductID) AS MaxDateStarted

    ...

  • RE: Creating a Hierarchy

    ramos.ferdinand (10/17/2013)


    Sorry guys if my message was not that clear and havent put the DDL. 🙁

    Cadavre, yes you hit it right! I wanted the result you've posted. But the solution...

  • RE: Who talks SQL out of work...

    My girlfriend wouldn't understand it if I spoke to her. She doesn't want to understand it, so no point in using analogies. At best, I'd get the smile and nod...

Viewing 15 posts - 151 through 165 (of 2,006 total)