Bill of Materials Problem in SQL Server 2008

  • First post so sorry for the Noob questions!

    I am experimenting with solving a bill of materials (recursion) problem in SQL Server 2008.

    Technical issues:

    1. Within Visual Studio, how do I get the command line to test my SQL code? e.g. if I want to create a table, test a query etc... how do I do this from the command line

    2. I try to open my DB in SQL Server Management Studio, to find error pasted below. Any ideas why?:

    Recursion Issues

    3. SQL Server does not support the expression "With Recursive" as far as I am aware. I believe that the only way of running a recursive query in SQL Server 2008 is using Common Table Expressions. Is this true? What other methods could I use?

    TITLE: Connect to Server

    ------------------------------

    Cannot connect to C:\Users\......mdf.

    ------------------------------

    ADDITIONAL INFORMATION:

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476

    ------------------------------

    BUTTONS:

    OK

    ------------------------------

  • gravy1nt (3/14/2012)


    First post so sorry for the Noob questions!

    I am experimenting with solving a bill of materials (recursion) problem in SQL Server 2008.

    Technical issues:

    1. Within Visual Studio, how do I get the command line to test my SQL code? e.g. if I want to create a table, test a query etc... how do I do this from the command line

    Not within Visual Studio, but you can use sqlcmd.exe to issue queries from the command line. If you have the SQL Server Client Tools installed you will be able to open sqlcmd.exe from a cmd shell prompt. sqlcmd Utility

    2. I try to open my DB in SQL Server Management Studio, to find error pasted below. Any ideas why?:

    When using SSMS you will connect to a server name, not to the fully qualified path to a data file (i.e. .mdf file).

    What is your server name? If it is a local instance of SQL Server Express Edition then it will be something like <your_machine_name>\SQLEXPRESS, e.g. WORKSTATION1\SQLEXPRESS

    Recursion Issues

    3. SQL Server does not support the expression "With Recursive" as far as I am aware. I believe that the only way of running a recursive query in SQL Server 2008 is using Common Table Expressions. Is this true? What other methods could I use?

    A recursive CTE is the way to go. Recursive Queries Using Common Table Expressions

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply