.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Running DB script with App install

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Sql Server

I've got a Windows Service app I wrote that requires three new tables and several views and SPs to be created.  I've got a complete script that works and have added a custom action in the form of a VBS file that references the script file. 

My vbs file looks like this

Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Run ("sqlcmd -S OFFICE8995 -U sa -P mypassword -d DBName -i C:\Program Files\ITService\TestScript.txt")

I can run the TestScript in Query Analyzer and it works but the VBS file is not working.  The database is a MSDE 2000 db and was hoping to use sqlcmd which I do have on this box. But the osq isnt working either.

How can I debug this?  Anything obvious that I'm missing?



View Complete Post

More Related Resource Links

Client script not running


Dear all,

in my MVC 2 application, and in the shared Master Page I wrote this little script for menu handling :

<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript"> $(document).ready(function () {   
     $('#nav li').hover(  
         function () {  
             //show its submenu  
             $('ul', this).slideDown(100);  
        function () {  
           //hide its submenu  
            $('ul', this).slideUp(100);           

The script, that shows menu items when the

Incorrect syntax near 'GO' error while running a sql script ?


I am using Visual Studio 2008

I have one Database A

now i want to create Database B just like Database A

I generated a script of Database A

and created fresh Database B

Now, when i try to run the generated script against Database B, i get this error, why ? how to fix it ?

sql error

For your information:

I have checked in my script it is:


and i have also tried to save the sql script in notepad as: ANSI, UTF-8 and UNICODE

and then i copied from txt file to query but still doesn't work and getting the same error

and these are the option that i selected/used while creating my script:


FASTSEARCH install failure of post script

I have installed FASTSearch as per link  http://www.microsoft.com/downloads/details.aspx?FamilyID=bcc37c48-11fb-40a2-8cfb-743de20260f6&DisplayLang=enI followed the instructions in the B2FASTSearchDeploy Installed  SharePoint farm.Ran the PrerequisiteInstaller installer - no errors that I could see Created the additional directories in the C:\FASTSearch\data\data_security and finally ran the psconfig script in the powershellBut tried numerous times and always got the same messagePS C:\FASTSearch\installer\scripts> .\psconfig.ps1 -action i -roleName single -userName ptcnet\wmadm -localMachineName fc-vm207.ptcnet.ptc.com -databaseConnectionString fc-vm207 -databaseName fastsearch -baseport 13000Please wait while Windows configures FAST Search Server for SharePoint. Configuration may take several minutes... An error occurred while configuring Post setup - C:\Program Files\Common Files\Microsoft Shared\ULS\14\ULSControllerService.exe You cannot call a method on a null-valued expression.At C:\FASTSearch\installer\scripts\include\logging.ps1:280 char:33If I navigated the dir C:\Program Files\Common Files\Microsoft Shared\ULS\14I see no ULSControllerService.exe  ..... I have nnot been able to figure out what I have missed .... can anybody help?

stop running this script error in htmleditor

Hello, I am using AjaxToolkit 3.5 for HTMLEditor contorl. In one of the form i have pasted around 50 pages of word document. While i tried to save the input to the database, i get javascript popup error message saying "Stop running the script". Any help would be appreciated.  

Error when running an SQL script to restore a database on SQL Server 2008 R2 Express

Hi, At work, I use SQL Server 2008 Express running on Windows XP Professional Service Pack 3. At home, I also use SQL Server 2008 Express running on Windows XP Professional Service Pack 3. Whenever I do work on the database at work, I usually restore the database at home (or vice versa) I have been using the following SQL scripts to back up the database and to restore the same database (at work or at home). BackupRealEstate.sql USE Master BACKUP DATABASE [RealEstate] TO DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH NOFORMAT, INIT, NAME = N'RealEstate-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO RestoreRealEstate.sql USE Master RESTORE DATABASE [RealEstate] FROM DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH  FILE = 1, NOUNLOAD, REPLACE, STATS = 10 GO Everything worked fine until I replaced my 8yo home computer with a newer and faster one. My new home computer is running Windows 7 Home Premium and I use the latest SQL Server 2008 R2 Express. When I tried to run the above restore SQL script, I got the following error message: Msg 3101, Level 16, State 1, Line 2 Exclusive access could not be obtained because the database is in use. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally. There was no other application/process using this database. Can someone please help me? Regards,

Problem running jquery script in Content Page

Hi!! I have a master page in asp.net and a content page with some basic asp.net controls like textbox,buttons,treeview....i have a jquery script in the content page and reference set to the jquery file..The script changes the text property of a button on the keydown event set for the textbox...the script works fine if i copy and paste it in a normal page...the script only ran once when i worte it for the first time the next day when i tried to run the script it was not working..i m facing this problem for running the script in content page and i a m not aware of how to write jquery script for the content page.. i m really not finding any solution where i am wrong i have even tried setting the internet explorer security setting to low..plz plz plz plz plz plz help me on Thanks!!

Running Client Script to Read TextBox Value from AJAX PopupControl Extender


I used PopupControl Extender to display row details from a gridview, and need to update the two textboxes, but the changed value in the textboxes did not get picked up when click the update button on the popup window, so I need to get client side javascript to read the new changed value from these text boxes. However, I tried a few way, none worked for me, not sure what is wrong.

1. Add a javascript function in the .aspx file and use onclientclick of the linkbutton control to call the function, I got error of "Microsoft JScript runtime error: Object required".


<script language="javascript" type="text/javascript">
     function newTextValue(textbox) 
      var text = document.getElementById("TextBox1").Value;

<asp:TextBox ID="TextBox1" runat="server"  Text='<%# Bind("GalleryTemplateName") %>' Height="20px" Width="230px"
                    style="text-align: left"></asp:Text

Can I install SQL 2008 on a server running SQL 2005 to install Sharepoint 2010 Enterprise (Productio



Sharepoint 2010 Upgrade Question - A customer is currently running sharepoint 2007 on a 64bit windows 2003 OS with SQL 2005 sp2, they are looking to install/upgrade to Sharepoint 2010 and want to use the current SQL server,for the upgrade a new SharePoint 2010 environment will be built and for a short while they will have two instances of SharePoint running SP2007 and SP2010. The plan is to then manually migrate the data from SP2007 to SP2010 (ENT), the web and application servers will be newly built. From research I think they have three options

1) Upgrade the current SQL 2005(SP2) instance to SQL 2008 R2 standard.

2) Install a new instance of SQL 2008 R2 on the same server and have both SQL 2005 & SQL 2008 running on the same server (Is this an option? Will sharepoint happily run from a SQL server running two SQL instances, do I have to be careful regarding the installation and configuration, could I break the existing sharepoint farm doing this?)

3) Upgrade the current SQL server to SP3 and install a new instance of SQL 2005 SP3 and install SharePoint 2010 Enterprise here, again I have all the questions from point 2 above.

We are thinking of trying option 1, then 2, then 3, and obviously only moving to the next option if we come across a show stopper. H

Running an XMLA script of a database on another database



I used the "Script Database as -> Create to" option on an Analysis Services DB and now I'm trying to run the script on another DB server, but I get an error message that it already exists, and indeed it does, but then when I delete it and run the script again, I get a message that it doesn't exist(!) or the user doesn't have access to it (but it's actually defined as having server-wide permissions). Does anyone have an idea what the problem might be? What am I missing here?


How I disable query results window while running a script


I am running a sql script which Inserts 500 rows and after each insert, it calls a stored procedure which diplays result in the results window. So after executing 100 rows, it throws an error that maximum number od results in the results pane has reached its limit but the query executes successfully. How can we disable the stored proc output to not display in the results pane. I do not have access to the stored procedure.

invalid character whil running the open xml script

hi i am facing problem while running the following sql statement

 SET NOCOUNT ON DECLARE @hDoc INT EXEC sp_xml_preparedocument @hDoc OUTPUT, '<NewDataSet> <Forms Layout=''&lt;StackPanel Background=&quot;#FFFFFFFF&quot; Name=&quot;StackPanelUser&quot; Width=&quot;1001&quot; Height=&quot;600&quot; Margin=&quot;10,5,10,5&quot; HorizontalAlignment=&quot;Center&quot; ClipToBounds=&quot;True&quot; twcdd:RadDragAndDropManager.AllowDrop=&quot;True&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:iedf=&quot;clr-namespace:Iris.Ews.Designer.Form;assembly=Iris.Ews.Designer.Form&quot; xmlns:twcdd=&quot;clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls&quot;&gt;&#xD;&#xA; &lt;ScrollViewer HorizontalScrollBarVisibility=&quot;Auto&quot; VerticalScrollBarVisibilit

Running SQL script using c#


Hi Guys,


I'm having a problem when trying to run a SQL script from c#. I'll post my code below. I have been searching the net for a few days now and I believe my code is now correct, however I do not know how to fire it off to run the .sql file.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Debug="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="form1" runat="server">
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebC

Warning: Cannot debug script tasks when running under the 64 bit version of the Integration Services


Is there any workaround for that (other than switching to a 32-bit computer)?



SQL Server Agent running VB Script problem



I am kinda stuck in the issue... and tried various things but no luck so far..

I am running DTS that has a VBscript to executes one exe and passes certain paramters as follows:

WSHShell.Run chr(34) & Apppath & chr(34) & " " & AppParama,7,True

This shell command calls another program which is 3rd party tool, thats create the output file

If i run DTS manually it runs fine but when SQL Agent runs it it does nothing... the job reports as executing correctly, but in fact does absolutely nothing.

any suggestion will be appreciated.

thanks in advance.


Farhan Ahmed

Cannot install .Net Framework 4. get error 0x80070643. running Vista 64b


i have tried cleaning Temp folder, uninstalling previous versions of .Net with the cleanup tool, checked windows installer service (tried automatic and manual), tried running SFC / Scannow, running it with administrator, going to regedit and checking the values, tried to use Microsoft Fix it 50123 and it failed, and tried to reinstall microsoft installer 4.5 and said update does not apply... nothing works.  i have all updates installed on my computer except .Net 3.5 SP1 Family Update. it gives me error code 643.

no .Net programs show up in my add/remove programs list.

ive been trying to troubleshoot this for 3 days to no avail. any help?


Returning IDOK. INSTALLMESSAGE_ERROR [The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.]
[3/26/2011, 16:4:51]MSI (C:\29d5d9176258bf3c7992\netfx_Core_x64.msi) Installation failed. Msi Log: Microsoft .NET Framework 4 Setup_20110326_160347874-MSI_netfx_Core_x64.msi.txt
[3/26/2011, 16:4:51]PerformOperation returned 1603 (translates to HRESULT = 0x80070643)
[3/26/2011, 16:4:51] Action complete
[3/26/2011, 16:4:51]Error 1603:171

Issue in SQL server agent job running SSIS package containing a batch script.


I have a package that I have created that runs locally and as package on the server that has a batch script with in it and it run correctly when manually run. But when I create a sql server agent job it runs the job but doesn't execute the package but returns with a successful run. I have setup a proxy account trying to run it with this. I have given the permission to the batch script to the file that the SQL service account. I have tried everything I can think of even setting the package creator to the same name as the service account in the package, and even doing a dtexec command from the SQL job. If I run the dtexec from a cmd prompt the package runs. Need help please thanks.



Rendering ASP.NET Script References into the Html Header

One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend