Forum Replies Created

Viewing 15 posts - 2,896 through 2,910 (of 13,461 total)

  • RE: query to return top 10 tables on each db on server

    gchappell (11/21/2013)


    i need a query to return the top 10 tables in each database on a server. have used EXEC sp_msforeachtable 'sp_spaceused ''?''' which returns what I need for one...

  • RE: Maximum Number of "When Then" lines in a CASE statement?

    terrencepierce (11/21/2013)


    Hey, I appreciate the test. I have a list of thousands of entries (people have a habit of typing the same thing very different ways) that I need...

  • RE: removing lettering in front number in field

    /*

    (No column name)(No column name)Comment

    14123abcFishing lake 123abc

    19876poiElk Hunting trail 876poi

    */

    ;WITH MyCTE([Comment])

    AS

    (

    SELECT 'Fishing lake 123abc' UNION ALL

    SELECT 'Elk Hunting trail 876poi' UNION ALL

    SELECT 'Non qualifying comment'

    )

    SELECT PATINDEX('%[0-9]%',Comment),

    SUBSTRING(Comment,PATINDEX('%[0-9]%',Comment),30), --assuming only 30 chars...

  • RE: Update field based on condition

    Abu Dina (11/21/2013)

    Hi Lowell,

    Not sure this is going to work for order number A1002

    Thanks.

    you are right; after i saw your post, i realized i misread the requirement and that...

  • RE: Looping through multiple dbs in a view

    with a set list of databases, you could create a view that does multi database calls like this:

    CREATE VIEW [dbo].[VW_PERSON_DETAIL]

    AS

    SELECT

    'Database1' AS DB,

    ...

  • RE: Update field based on condition

    great job providing the DDL!

    i'm assuming the key indicator here is the OrderQty - ReceivedQty columns to determine the status.

    this seems to work for me in limited testing:

    select * ,

    orderStatus...

  • RE: I'm baffled - Msg 15022 The specified user name is already aliased

    the issue here is an orphaned user: that is, you have a SQL login [sw] , but you restored the DATABASE from another server....that local.sw <> restoreddb.sw , based on...

  • RE: odd situation

    Snargables (11/20/2013)


    How can u have the same tablename in sysobjects w/ different id's. It's making one of my processes fail. The difference in the records is the uid. I didnt...

  • RE: Database without ANY primary keys

    it might be the product of someone who thought to keep their database design as if it were secret and proprietary, and have no PK's so you can't deduce the...

  • RE: 2012 Management Studio Server Name

    briancampbellmcad (11/20/2013)


    I went to Services and found nothing relating to SQL Server.

    in that case, it sounds like you only have the SQL server Manangement Studio tools, and not a local...

  • RE: Script Concern

    not to public.

    if they need to run sp_Oa*, then only grant it to one specificl role or user/login that will actually need and use it.

    depending on what they are actually...

  • RE: 2012 Management Studio Server Name

    your local server has a number of aliases, and you might need to specifically look in Administrative tools>>Services to see if you have named instances.

    assuming a default isntance, you could...

  • RE: Difference between dates

    no solution, just consumable data:

    i ran out of interest int he issue after converting to usable data:

    ;WITH MyCTE([EmpNo],[BudgetYearStart],[BudgetYearEnd])

    AS

    (

    SELECT convert(int,'2698'),convert(date,' 2013-02-01'),convert(date,'2014-01-31') UNION ALL

    SELECT '67682',' 2013-01-01','2013-12-31' UNION ALL

    SELECT '43320',' 2013-02-01','2014-01-31' UNION ALL

    SELECT...

  • RE: Linked server/ very restricted access

    Beatrix Kiddo (11/20/2013)


    finally, you add the linked server on server A, and make sure you use the mapping idea fromt eh screenshot: login not defined = not be made, and...

  • RE: Linked server/ very restricted access

    ok perfect, if he's using a SQL login, it really goes towards the screenshot i provided.

    on the remote server, a database role (in the apropriate database(s)(ie LIMITED_ACCESS), and make sure...

Viewing 15 posts - 2,896 through 2,910 (of 13,461 total)