Create SQL Instance using SMO and VB.Net

  • As part of the installation process of an application we are distributing I'd like to be able to create an Instance of SQL Server - if it does not already exist.

    The next step is to attach the database we are distributing to that Instance. I have the attach process working but the user has to tell me which Instance to use. I'd like to be able to create an Instance then attach the distributed database to the new instance.

    Is that possible? Or is there a better way to distribute SQL Server databases. The user's performing the installation process are not capable of attaching a SQL Server database. And in may cases are not able to pick the Instance from the list provided.

    I'm using VB.Net and Visual Studio 2005.

    [Post Script: Read Steve Jones remarks near the end of this topic and ignore the rest of the inane comments. It will save you some time.]

    Thanks,

    Larry Rebich

  • Attaching the database can definitely be done from SMO. A SQL instance, however, requires an install, AFAIK. Can't be done just from SMO.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • It is done when SQL Server is installed by Visual Studio so it can be done programmaticly.

    Who knows how to use SMO/VB.Net to create an Instance of SQL Server?

    Please don't answer if you don't know how.

    Thanks,

  • Larry Rebich (5/27/2009)


    It is done when SQL Server is installed by Visual Studio so it can be done programmaticly.

    Who knows how to use SMO/VB.Net to create an Instance of SQL Server?

    Please don't answer if you don't know how.

    I didn't say that it couldn't be done. I said that it could not be done with SMO (you will note that this is an SMO forum). And Visual Studio does not use SMO to do it either.

    Good luck...

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Larry Rebich (5/27/2009)


    Please don't answer if you don't know how.

    Thanks,

    No, thank you!

    -- You can't be late until you show up.

  • Larry Rebich (5/27/2009)


    It is done when SQL Server is installed by Visual Studio so it can be done programmaticly.

    Who knows how to use SMO/VB.Net to create an Instance of SQL Server?

    Please don't answer if you don't know how.

    Thanks,

    Sorry, not a good way to win friends or influence people on this site. May I suggest you leave your attitude outside of your keyboard.

    Visual Studio probably using a install script (along the lines of an unattended install) to install SQL Server. And it may even ask for information during the install. We already had DE installed on our desktop systems when we installed Visual Studio Professional Edition so didn't need to install SQL Server again.

  • Larry Rebich (5/27/2009)


    Please don't answer if you don't know how.

    Do you think these comments are helpful?

    Start here[/url]

  • There are more than 103,000 Google Search results using keywords 'smo create sql server instance'. Some of them look promising. I'm betting there is a way to create a SQL Server Instance using SMO. I was hoping someone in this forum had done it already and that I would not have to look at all 103,000 entries.

    Larry

  • I use Google search a lot to find solutions to common programming problems. Many of the forum topics found in the search look promising. Then when you read thru the topic you see lots of inane responses that help no one. Some people respond to the first thing that comes to mind and it often is not helpful but is a waste of time. We would be better served if the forums were not a place to 'chat' when real solutions are requested.

    So yes, please don't respond to my posts unless you have a solution to the question that I poised. That way the next time someone search on this topic they may find a solution rather than guesses.

  • Lynn Pettis (5/27/2009)


    Larry Rebich (5/27/2009)


    It is done when SQL Server is installed by Visual Studio so it can be done programmaticly.

    Who knows how to use SMO/VB.Net to create an Instance of SQL Server?

    Please don't answer if you don't know how.

    Thanks,

    Sorry, not a good way to win friends or influence people on this site. May I suggest you leave your attitude outside of your keyboard.

    Visual Studio probably using a install script (along the lines of an unattended install) to install SQL Server. And it may even ask for information during the install. We already had DE installed on our desktop systems when we installed Visual Studio Professional Edition so didn't need to install SQL Server again.

    Hmmm, 103K responses on Google plus one attitude on SSC...what were you expecting?

    -- You can't be late until you show up.

  • Barry gave you a very good hint. Take it!

  • Larry Rebich (5/27/2009)


    I use Google search a lot to find solutions to common programming problems. Many of the forum topics found in the search look promising. Then when you read thru the topic you see lots of inane responses that help no one. Some people respond to the first thing that comes to mind and it often is not helpful but is a waste of time. We would be better served if the forums were not a place to 'chat' when real solutions are requested.

    So yes, please don't respond to my posts unless you have a solution to the question that I poised. That way the next time someone search on this topic they may find a solution rather than guesses.

    Say goodbye Larry.

    We here on SSC much prefer to behave in a professional manner. Is this how you would talk to someone in person that you had asked for help?

    Please, think about it. In my humble opinion, you owe us an apology.

  • Larry Rebich (5/27/2009)


    I use Google search a lot to find solutions to common programming problems. Many of the forum topics found in the search look promising. Then when you read thru the topic you see lots of inane responses that help no one. Some people respond to the first thing that comes to mind and it often is not helpful but is a waste of time. We would be better served if the forums were not a place to 'chat' when real solutions are requested.

    So yes, please don't respond to my posts unless you have a solution to the question that I poised. That way the next time someone search on this topic they may find a solution rather than guesses.

    Had to come back and read this post again and comment. This site is a community, and yes, we go off on tangents on many of the threads on topics that may have nothing to do with the question asked. But guess what, that happens in normal conversations as well. And many times the diversion actually helps people with coming up with solutions because they are pulled away from the problem at hand for a bit. I call it the forest and trees syndrome.

    Best thing you can do is live with it, the worst, just ignore it.

    We are professionals, and we try our best to help people when they ask for it. Having an attitude and telling us don't answer if you don't know really doesn't help you on this site.

  • AFAIK, you cannot create an instance programmatically using SMO. The setup program for SQL Server has to run, which is what VS does. It has a setup file set that determines the name, locations, etc.

    Once that is up, you can create databases using SMO.

    I suggest that you look at Finebuild (http://www.codeplex.com/SQLServerFineBuild/) or something like the Express installer: http://groups.google.com/group/SQLSERVER2005/browse_thread/thread/56748d71d0e58222

  • OK I'll ask the obvious:

    if SMO is available, why would you create a separate instance, eating up resources, instead of just adding a database to the existing installation you already know exists?

    If any third party application wanted to install a separate instance, i would nix it right away, because it would be outside of the existing backup regimen on the existing server. matter of fact, like Gail said, I've made sure the install script for Studio doesn't run because our machines run the Developer version instead of Express anyway.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 15 posts - 1 through 15 (of 21 total)

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