.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

Need help running sql as batch file that creates a list of borrowers

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

Our application database was recently upgraded from mssql server 2000 to 2008.  I am unable to get a batch file that creates a list of updated
borrowers to run.  It was running fine on Windows server 2000 (even after the upgrade to mssql 2008), but I
recently wiped that old server and installed windows server 2003.  The
drive that the file lives on changed, so I changed the name in the
file, but it will not run.  When I try to run it from a command prompt
I get the error:

'melcat_daily_borr_export.bat' is not recognized as an internal or
external command, operable program or batch file.

The text of the file is :
isql -S192.168.36.2 -Pmypassword -Umyusername
-iD:\Horizon\melcat\melcat_daily_borr_export.txt -b -h-1 -n -w800 -O

I have tried running the command with the name in quotes, I have
changed the file to a .cmd rather than a .bat, all to no avail.  The
sql that the file calls will run and return results.  Yes I am using
my proper user name and password.

The text of the sql called is this:

use horizon

set nocount on



View Complete Post

More Related Resource Links

running multiple sp through osql cmd from batch file


how to run multiple sp from batch file through osql command and for loop.?


i tired this command from batch file

i have created a batch file for example say 5 ctored procedures.when i execute it showing errors whereever needed and for the command executed successfully it shows only numbers like this



how to turn off this numbers  is there any option?

and my code is beloe

@echo off

OSQL -U() -P() -S() -d() -i c:\SQLQuery2.sql -o c:\execsql.txt

and how topass parameters to the switches like u,p?

List common file types in a .NET project.

List common file types in a .NET project.

Consistently running out of page file memory with full text indexer

Using MS SQL Server 2008 SP1 x64 Standard Edtion on Windows 2008 R2 Enterprise, I'm about to full-text index for the first time 1 table and 2 views. The table contains about 250'000 entries with a data space of 180 MB. As soon as I activate the full text indexing, the fdhost.exe task starts to consume slowly but surely all the available page file space (this can be easily watched using the Resource Monitor and the Commit Charge graph on the memory tab). Once all the virtual memory has been consumed, the server becomes unusable since it can't open any new windows any more, and RDP stops working. The machine specs are as follows: 12 GB of RAM 80 GB free on hard disk out of 136 GB 8 CPUs Custom size paging file with sizes between 24 GB - 60 GB (originally, this was system managed size, but then the server ran out of memory sooner) Max SQL server memory set to 6 GB (first 10 GB, then 8 GB) I've set the max fulltext crawl range to 8. During the indexing, the 8 CPUs are bit busy for a while, but not excessively. What is astonishing is that there is almost no use of physical memory during the indexing (I can see an increase from 2 GB to 3 GB which still leaves plenty of RAM available). Does anybody have an idea how I can convince fdhost.exe to consume physical memory and leave the paging memory alone? Or what else can I try?

Problems running a bat file within a SSIS package

I have a ssis package which has 2 tasks, first it builds an excel sheet with data on the server from where I am running the ssis pkg and the second task (a sql process task), runs a bat. the bat file that basically copies the  excel sheet created from the first step to another server. Problem is that the ssis pkg runs succesful when i run it from BIDS, bust when I run is as ajon, it gets hung. It completes the first step, it is the sescond step that is get hung. I noticed that when i run from BIDs, it does come up with a window open file - security warning and says the publisher could not be verified, are you sure you want to run this software. why does it do that ??? the file I am asking to run is a .bat file. it should automatically use the cmd.exe app to run the bat file. Please help !!!   Thanks in advance.

Powershell script to copy a list attachment to a file

I have a script that builds a list of items.  I'd like to add the ability to download the list items' attachments to a local directory.  IS this possible?  There are lots of examples of how to add attachments but nothing that can download the attachments.  Any help would be appreciated.

Run a batch file at server side

Hello,         I am creating an intranet application which runs a batch file and create an xml file as result. Which i am using for further processing. My problem is when i am running my application from local machine batch file is running fine and creating xml,but when i am running it through iis nohting is happening,it meance process.start coudn't start command Prompt.I am using following code. I have given all permission to iis.Dim ProcessInfo As Diagnostics.ProcessStartInfoProcessInfo = New Diagnostics.ProcessStartInfo("cmd.exe", "/C " + Server.MapPath("~\myScript.bat"))        Dim Process As New Diagnostics.Process       ProcessInfo.CreateNoWindow = False        ProcessInfo.UseShellExecute = False        Process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal        Process = Diagnostics.Process.Start(Server.MapPath("~\Spandata\RunSpan.exe"))       Process.WaitForExit(20000)        Process.Close()

customize list view table header css file

i need to make table header for my list to be red and on hover to get specific  image so all my site have the same appearence also i need this to reflect to the list view webpart thanks

MDAC SDK - why is the list of OLE DB providers different to what I see when creating a UDL file?

In MDAC 2.8 SDK on Windows Server 2003 SE x64.  Using RowsetViewer 2.70, list of datasources is not same as when I edit a UDL file on the same server.  Why is this? I want to test a specific OLE DB provider, but it's not on the list within the SDK's tools.  I can see the specific provider in the registry, and it has the correct format as defined in the SDK's OLE DB documentation for providers, so It's installed correctly.  Note, the provider works okay with the application and tests okay in the UDL file edit dialog.  It's just the SDK that I can't use it in :-( Alternately, is there another (3rd party?) tool I could use?  All I'm looking to to do is run simple SQL query test via OLE DB to get timings.  Note, I'm a programmer, but not used to ADO or OLE DB interfaces - that's why I'm looking for a ready made tool :-) Any help would be be great, thanks, Richard.  

passing result from CS file to batch file?

Hello,I am trying to run a CS file within a batch file but so far nothing happens.. echo on cd \ net use z: \\CONFIGMGRTEST\SMSPKGC$\TST00014 rem FFCS-MultiPlatform.bat file rem a selection is made to know which program has to be launched rem SETTING THE LOCATION OF THE C# COMPILER SET framework=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727 rem COMPILING THE CS FILE %framework%\csc Architecture-Processor.cs rem EXECUTING THE C# APPLICATION :32BIT C:\Source Files\Packages\FOREFRONT\x86\FFCS.bat goto END :64BIT C:\Source Files\Packages\FOREFRONT\x64\FFCS.bat goto END :END exit and the CS file is: using System; using System.Management; public class ManagementObject { public static void Main() { /// ManagementObject mo; mo = new ManagementObject("Win32_Processor.AddressWidth=''"); ushort i = (ushort)mo["Architecture"]; /// Test the Processor and populated the field to be tested in the batch file switch (i) { case 0: return "32 Bit"; break; case 9: return "64 Bit"; break; } } } How do I pass the 32 Bit and/or 64 Bit collected by the CS file to the batch file to be used to the if .... goto 32Bit or 64 BitsThanks,DomSystem Center Operations Manager 2007 / System C

Query to list currently running queries on the sql server 2000

Hi all Who to check, what all queries are running curently on the sql server 2000, I need to list who all logged in and what queries are getting executed and how long its running. Thanks in advance. shan  

Can not find file when running app (I give up!!!)

Ok, I give Up!!!I created a deployment project in VS 2008.   It packages a Windows forms app.1- My application includes two XML files that that it needs to read from.  Those files were added into the solution.2- After installing the app via my deplyoment project, the app can not find the XML files that it needs,  it tells me that System IO can't find the XML files3- I notice that when the files are read, the app tries to read from the User\myprograms etc area.  Sometimes they are read from windows\system32 4- After I had added the files to my Windows forms app  I never specified a path when retrieving.  I figured the system was going to choose the application folder once deplyed and read from the same.  Maybe this is where the fault exists.  The application runs fine from Visual Studio.Can someone tell me if I have to specify a folder or if I have to use some sort of default syntax to make sure the files are written and read from the application folder.  The XML files have had the write always property set to true.I have tried moving the files around to no avail.  The code that loads one of the files is simply:xelement doc = xelement.load("myxmlFile.xml");??? NR

Batch file for use with SSIS

Greetings all, I'm trying to run the following batch file outside of SSIS.     DTEXEC /f "M:\Tim\SSIS\ImprtInvestOneNAVsGeneric.dtsx" /conf "M:\Tim\SSIS\EPIC.dtsConfig"      \Package.Variables[User::FilePath].Value;"M:\Tim\SSIS" /SET      \Package.Variables[User::SourceFileName].Value;"DIREXION_NAV.CSV" /SET         \Package.Variables[User::DoneFileName].Value;"BIAUSC50.DONE" /SET      \Package.Variables[User::SponsorID].Value;"56" /SET      \Package.Variables[User::FileDescription].Value;"Direxion NAVs (USA)" /SET      \Package.Variables[User::DBConn].Value;"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=M:\Tim\New             Basket DB\EPICUDT_Development.mdb;User Id=admin;Password=;" /SET  The purpose of this batch file is to allow our team to use the same SSIS package but with multiple file inputs. I am getting the following errors:   - Requires a higher level edition.  I've done some research on this and have found that you must have SSIS installed locallly (which I         do, the services indeed running).  I've also come across a 'fix' that says you can use the E

SharePoint 2010 Export list Items to Excel, wrong url in iqy file

Hi, I have a SharePoint 2010 Environment that uses https://portal.<something>.com. Exporting to Excel of a list uses wrong URL. When I go to the a list, select the list to show the "office ribbon" and then select export to excel, excel will show the error "Excel cannot connect to the SharePoint List". When I take a look at the IQY file that is created it contains the wrong url: http://portal.<something>.com instead of https://portal.<something>.com Changing the URL in the IQY file manualy to https://portal.<something>.com and then opening it will excel is working fine, list data is exported to excel then. Alternate access mapping is configured to use https://portal.<something>.com as default, export to access is working normaly. I already deleted the http://portal.<something>.com alternate access mapping once to see if this fixes the problem. No fix, even not after IISreset or rebooting the server. Where or how is the export to Excel IQY file created and where is it possible to fix the URL it is putting in the IQY file? Grtz, Arjan

Attach File to Custom List

Hello - I need to use the Client Object Model to attach an item to a custom list item.  I have attachments enabled on the custom list.  The following code will upload a attachment to a list item ONLY if at least one attachment was added to the item via SharePoint. Dim credentials As New System.Net.NetworkCredential(MyUser, MyPassword, MyDomain) Dim SiteUrl As String = "http://spsandbox13" Dim clientContext As New ClientContext(SiteUrl) clientContext.Credentials = credentials '-- List item 41 hard coded for testing Dim attachmentPath As String = String.Format("/{0}/Lists/{1}/Attachments/{2}/{3}", "sites/ITS/GBPlayground", "FormConfiguration", "41", "SomeFileNameForMe7") Using fs As New FileStream("C:\Users\gbadmin\Documents\WhatsUp.txt", FileMode.Open) Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, attachmentPath, fs, True) End Using The above code works great as long as the item already has an attachment.  If the item doesn't have an attachment I get a (409): Conflict error.  I've also tried to create a folder in the attachments folder for the list item to see if once the folder was created that the error would go away.  The code for this is as follows: Dim list As Microsoft.SharePoint.Client.List = clientContext.Web.Lists.GetByTitle("

run dtexec on server from batch file on client machine

Hi I would like to enable a user to execute an SSIS (2005) package located on a server.  The client does not have any elements of SQL server installed on his machine so he cannot execute the package locally.  At present he has to remote connect to the server and double click a batch file on the server that contains the dtexec script. I would like to have a batch file located on the client desktop that he can click, that will run the dtsexec script on the server - as it will not work from the client machine.  However every set of commands i try inevitably end up trying to run the package on the local machine, which obviously fails. Is there any way to have the client kick of the package and have it run on the server, without him actually having to directly remote desktop to the client? Thanks  Guy

File upload error -List View threshold setting


When I was trying to upload multiple images it was showing the following error.

"Failed to upload file 'filename'Try uploadiing again"

So when I looked into the Picture library setting it was showing


List view threshold :

5050 items (list view threshold is 5000).
The number of items in this list exceeds the list view threshold, which is 5000 items. Tasks that cause excessive server load (such as those involving all list items) are currently prohibited.

Learn about managing a large list or library and ensuring that items display quickly.


Whether it is the error with the threshold limit.If so whther I can change the limit and is it safe?



Excecuting sql batch file

I created a batch file to set db's online, that will be used after a server reboot in the event 1 or multiple db's do not come back online, my question is... I created this batch file in sql server 2005, and it will not work in sql 2000 or 2003, could I have done something wrong? Or is the issue that batch files are not backwards compatible? Thank you
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