Link to home
Start Free TrialLog in
Avatar of ma701sss
ma701sss

asked on

install SQL script?

I have SQL Server 2000 installed. How do I run an install script? It just appears as a text file and double clicking it just opens it in notepad. I have searched Google for what I thought would be a simple problem but I can't find an answer.
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Use Query Analyzer.  Under "Start", "All Programs", "Microsoft SQL Server", you should see an option for "QA".  Start it up, change the current database to the one you need, copy in the script, and run it.
Hi,

Can you post the full name of the script and the top 10 - 20 lines that you see in notepad?

It could be a .bat file - which shoudl run when you double click, a msi file, a .sql file ...

Most of which should be viewable in notepad.

Regards
  David
Avatar of ma701sss
ma701sss

ASKER

ScottPletcher: thanks, the script I believe *creates* the database, so when you say select the database I need, what do you mean?
Hi,

If it is creating a database, then Master is fine.

Regards
  David
True.  By default QA will start out in the master db.  If the script includes creating the db, that can be run from master.
no sorry, it doesn't create the db, just the tables. So how should I create the db? Should I do this in Enterprise Manager or QA? WHatever is best, please give steps. Thanks
Without a script, it's easiest to create the db in Enterprise Manager.  Then switch to that db in QA prior to running the script.
ok, in QA there's 3 or 4 options for scripting, "script object...". Which one should I choose?
You should already have the script.  From QA, just open the file you were given, the one that was automatically opening in Notepad, and see if it can run successfully in the database you just created.
Hi,

In Enterprise Manager
Expand the tree
Right click on Databases
Select New Database
Fill everything in. For a test database, the only key thing you must fill in is the name

Now go back to QA, select the new database - may have to refresh things to see it - and run the script.

Regards
  David
I clicked on "connect" whilst selecting the db I created, but it keeps opening up the master db. So, when I ran the script, it created the tables in the master db. How do i run the script and create the tables in the db I just created?
ASKER CERTIFIED SOLUTION
Avatar of David Todd
David Todd
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks David. Could you perhaps tell me what I need to edit in this webconfig file please, in order to connect to my database successfully in my web app?

Probably something to do with this line? : <add key="forumDSN" value="Provider=sqloledb;Data Source=localhost;Initial Catalog=itcnForum;User Id=forumdb;Password=itcn;" />


<!-- Web.Config Configuration File -->

<configuration>
      <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="forum.aspx" />
            <compilation debug="true"/>
            <pages validateRequest="false" />
            <identity impersonate="false"/>
            <httpRuntime maxRequestLength="4096" />
            <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" culture="en-US" uiCulture="en" />
      </system.web>

      <appSettings>
            <add key="theme" value="default" />
            <add key="forumDSN" value="Provider=sqloledb;Data Source=localhost;Initial Catalog=itcnForum;User Id=forumdb;Password=itcn;" />
            <add key="popularThreshold" value="5" />
            <add key="allowAnonymous" value="false" />
            <add key="allowAnonymousAttachments" value="false" />
            <add key="virtualDirectory" value="\ITCNForum" />
            <add key="avatarDirectory" value="/ITCNForum/gfx/forum/avatars/" />
            <add key="physicalDirectory" value="C:\Inetpub\wwwroot\ITCNForum" />
            <add key="websiteAddress" value="http://yourwebsite/ITCNForum/" />
            <add key="search_stopwords" value="C:\Inetpub\wwwroot\ITCNForum\admin\includes\search_stopwords.txt" />
            <add key="emailServer" value="yourmailserver" />
            <add key="emailServerSender" value="forum@yourdomain.com" />
      </appSettings>

</configuration>
Hi,

You are right -
Probably something to do with this line? : <add key="forumDSN" value="Provider=sqloledb;Data Source=localhost;Initial Catalog=itcnForum;User Id=forumdb;Password=itcn;" />

Inthe following
<add key="forumDSN" value="Provider=sqloledb;Data Source=YourServerName;Initial Catalog=YourNewDatabase;User Id=YourUserID;Password=YourUserPassword;" />

Change the values for Data Source, Initial Catalog, UserID, Password

Regards
  David
that all makes sense, other than the user and password. Where is this defined in the db? I can't see anywhere to define this in QA, etc. When I connect to sqlserver it uses windows authentication. Is this anything to do with the password for the db? I tried putting my windows login details into the webconfig file but this did not work.
Hi,

For Windows Authentication, add this
Trusted_Connection=yes

<add key="forumDSN" value="Provider=sqloledb;Data Source=YourServerName;Initial Catalog=YourNewDatabase;Trusted_Connection=yes;" />

Something to note:
In the real world, your application is likely to be running in the IUSR_WebServerName account as an anonymous web login. In this case, you will need to add a SQL user to the server, and give them appropriate rights to the database and tables.

See adding a user in BOL, and look for the Enterprise Manager steps

Regards
  David
Thanks, I get:

"Cannot open database requested in login 'ITCN'. Login fails."

Anyway, never mind, I will persist with it and hopefully solve it soon. Thanks for your help - and extra help :)
Hi,

In SQL, have you set up the user and login?

Just because you are using a valid windows login doesn't mean that it has any rights to SQL.

Regards
  David

PS This should go to another question with more points ...