Simple Batch Program Example

Sep 7, 2006

Can someone point me to some examples of batch scripts that will allow me to write a simple tool which can reliably detect if any instances of SQL servers are running on a machine and if running, then their names.

Hopefully the tool should be robust enough to run on diff flavors of MS Windows.

Thanks

View 1 Replies


ADVERTISEMENT

Running SQL In A Batch Program

Apr 6, 2001

I need to create a program that will run Client Access to download data from the AS400 to a flat file, then run SQL DTS to import the data into a table for use by another software package.

I've created a bat file that does that using the CA RTOPCB command and the SQL DTSRUN utility. Problem is that it appears that I need to first check to see if there is a table in SQL and if there is to delete it. Otherwise, rather than overlay the existing data in the table it adds to it.

Is there a way to issue a SQL drop table in DOS? Or am I missing something that could be done in SQL?

The DTSRUN is using a local package and CA is using a transaction request.

View 1 Replies View Related

PLEASE TELL ME HOW TO WRITE A BATCH FILE PROGRAM FOR THIS SITUATION

Apr 29, 2008

hello,


I have to write a batch file program that will just copy the names of the files from a particular folder.

Which means some command that could go into that folder through a path provided and get/copy just the name of the file.



Regards

Thank You

View 2 Replies View Related

How To Write Batch Program In SQL Server 2005?

Sep 10, 2007



Hello All,
I want to write Batch Program which will insert Data into Table every day based on some conditions.
can anyone please let me know how to write Batch Process in SQL server 2005??
Thanks.

View 5 Replies View Related

Simple Batch Job Handling

Mar 6, 2008

Hi!
I was told SB could be a good solution (-:

What I have now:
Machine with 8 cores and 8 scheduled jobs running every minute to check
if there is new row in one queue table (rows assigned to queues/job by using modulus 8 on identity column).

The scheduled jobs run an stored procedure, that filter "its own" rows from queue table (scheduled jobs sends input parameter to proc, so proc can identify which queue it is).

Inside the proc an dynamic, local cursor is used where I order-by on column corresponding to source of request, since some peoples requests are more important than others ;^) Every queue handles more rows at once if exists.

This gives me 8 paralell queues, but since some requests take longer to handle than other I can see periods
where only 4 queues running and the rest does nothing while jobs are waiting. There are probably other drawbacks, please tell me.

How to solve this with Service Broker?
Do you know some good links with examples?
Can SB support the need of ordering? It should not be first in - first out, it should be: most important first...

Best Regards
Bjorn

View 1 Replies View Related

Can An One Help Me With Writing A Simple Batch Fileee...Pleasee

Apr 25, 2008



Ok I have 2 batch files and I have rum them one after one another. I am using

call batch1.bat
call batch2.bat

It is running the 1st batch fil successfully but it is not running the second one. I used a pause to see th e error it says some internal and external batch error.

Ok batch1 is at the desktop. and batch2 is in one of the folders in the desktop.

Nature of batch1 is that it runs successfully.

Nature of batch2 is that it gives and error if I individually execute it. But when I am running together then its not showing the error.l

Please if u did not understand this situation atleast show me how to run two batch files using command lines.

Thanks

View 6 Replies View Related

Do Sqlexception Breaks The Functionality Of The Program? (program Flow)

May 23, 2007

why we use sql exceptions ...

what the program will do if we caught that exception .. i need some suggestions ... i got this exception(String or binary data would be truncated.
The statement has been terminated.).. will it affect the functionality of the program...

hiow can i avoid this exception..

View 1 Replies View Related

Can I Return A Value In A Variable From A SSIS Program Back To C# After The SSIS Program Is Run From C#?

May 21, 2007

Can I return a value in a variable from a SSIS program back to C# after the SSIS program is run from C#?

View 1 Replies View Related

Passing Parameters To Batch File And Executing Batch File Loop

Aug 7, 2007

HELP,

I need to take a variable from a tabel in SQL Server pass to a Batch file and execute the batch file. Right now I can exec the batch file with XP_CMDSHELL but how can I pass the variable to the batch file and loop through all the variables.

Please help

Phil

View 4 Replies View Related

SQLCMD Batch File With Script In Batch File

Dec 5, 2006

I am using the following batch file to execute a script that creates a db and all its objects in the local sql express:

sqlcmd -S (local)SQLExpress -i C:CreateDB.sql

This works fine, but I'm wondering if there's an easy way to put the script in the batch file, so users don't have to worry about putting the script in the C drive. I tried getting rid of the i parameter and pasting the script from the sql file into the batch file, but it didn't work.

Thanks,

Dave

View 1 Replies View Related

Simple Simple Linking Tables & Perform Calculation

Mar 22, 2007

found it

View 3 Replies View Related

Simple Question (Hope Simple Answer Too)

May 26, 2004

Hey,

I have MS SQL database.
I have procedure:



code:--------------------------------------------------------------------------------
CREATE PROCEDURE dbo.Reg_DropTable
@ModuleId varchar(10)
AS
declare @TableName varchar, @kiek numeric
set @TableName = 'reg_'+@ModuleId

begin
DROP TABLE @TableName <- HERE I GOT ERROR
end
GO
--------------------------------------------------------------------------------


I got error when using variable with tables names.
How to do this?

Ps. Number is send to this function and it must drop table with name Reg_[That number]

View 1 Replies View Related

Help In Program

Aug 29, 2001

i have a program which should give the out like this
XAPIALTMKT20010829105525.TXT

but its giving the output = 'X'
which is just the first initial...how
can i get this...

if i don't write the @filename=....
only then its giving the output..but i want to store it in the
varable..how can i do that
================================
declare
@v datetime ,
@filename varchar

select @v=getdate()
select @filename='XAPIALTMKT'
+CONVERT(varchar, @v, 112)
+SUBSTRING(CONVERT(varchar, @v, 108), 1, 2)
+SUBSTRING(CONVERT(varchar, @v, 108), 4, 2)
+SUBSTRING(CONVERT(varchar, @v, 108), 7, 2)
+'.TXT'

print @filename
================================================

thanks,
Harish

View 2 Replies View Related

Get With The Program

Jul 23, 2005

It is very interesting to me that most people in this group can't do simpleSQL. Are you viewing MySQL as a simple file system?As long as you do that,you willnot understand SQL in any dialect. So from now on:When you have a question about SQL. post the table structures. Uh, "WithCreate".Post some sample data in the form of INSERTS.Regards,Rich--The journey is the reward.

View 2 Replies View Related

SQL Program Question

May 22, 2006

Hello, i installed :

SQL Server 2005 Express Edition with Advanced Services
Install Microsoft SQL Server 2005 Express Edition with Advanced Services

but I do not see any program in my program menu to open it. Is this a stand alone program I can open? Thanks

View 2 Replies View Related

Mailsend Program

Oct 10, 2007

Hi All,

I am trying to send an email from a cmd prompt from SQL Server 2005 server using mailsend program. I am getting the message "Could not send mail". I am really stumped, don't know how to fix it. Any suggesstions?

Thanks.

View 3 Replies View Related

Mailsend Program

Oct 9, 2007

Hi All,

I have installed SQL Server 2005 and created a job. I made the job failed to test the mailsend program. The notification step that uses the mailsend succeeded but I did not get an email. I am using mailsend program on SQL Server 2000 and it works fine. I am really stomped and don't know what to do to fix it?

Thanks.

View 9 Replies View Related

Is It This Job Can Program In Trigger?

May 14, 2008

I've have following table,

tblHIT - this table will reveive record every minutes
Date | Time | Main_ID | Hit
------------------------------------
3/1/2006 | 100 | 200 | 8700
...
...
...
4/14/2008 | 100 | 200 | 4500
4/14/2008 | 100 | 201 | 8700
4/14/2008 | 200 | 200 | 3500
4/14/2008 | 300 | 201 | 7700
...
...

I've also 1 job in SQL Server Agent will execute STORED PROCEDURE and will filter 7 days record before from current date and insert it into tblHIT_7days. tblHIT_7days shown as follow
tblHIT_7days
Date | Time | Main_ID | Hit
------------------------------------
3/7/2008 | 100 | 200 | 8700
...
...
...
4/13/2008 | 100 | 200 | 4500
4/13/2008 | 100 | 201 | 8700
4/13/2008 | 200 | 200 | 3500
4/13/2008 | 300 | 201 | 7700

I've plan to create TRIGGER. This TRIGGER will insert the appropriate record from tblHIT into tblHIT_7days and also delete a appropriate record in tblHIT_7days. This INSERT and DELETE transaction depend on current date.

Is it possible, TRIGGER can do this?

View 6 Replies View Related

Triggers - C# Program

Oct 12, 2007

Hi,

In SQL Server is it possible to have a trigger that will throw an event which could be caught by C# program running in the back ground?

Is this even possible? If it is, have u any links to help/examples?

Regards!

View 4 Replies View Related

Using Sql Server In DB Program

Oct 26, 2006

I am about to build a program that will require the use of DB. In the pass I used Access as my back end, but this time I would like to use Sql Server. I just have a few questions before I begin.

1. After deploying and installing my program, do I need to have sql server installed on users system or can the DB file exist on its own and just use ADO.NET to access the file? (As I done in the pass to access my Access mdb file)

2. If I can deploy a sql file -- can it be done with Sql Server Express?

3. If it can't be done, what db program should I use?

View 3 Replies View Related

Program Locking Up While Using Rda

Apr 15, 2008

On some occasions when trying to send data back to the server, the program will lock up for up to 30 minutes. The code below is the rda data transfer process and the function IsConnected() determines whether there is a connection.

If Not MainFrm.IsConnected Then
rda.ConnectionManager = True
End If
If MainFrm.IsConnected Then
Dim sCon As String = "Provider=SQLOLEDB;Data Source=175.21.21.121;Initial
Catalog=OurDb;User ID=UserId;Password=pwd"
rda.InternetUrl = "http://Ourwebsite.co.uk/tfr/sqlcesa30.dll"
rda.LocalConnectionString = "Data Source=Program FilesSysdata.sdf"
For i As Integer = 0 To RecCount - 1
Try
rda.SubmitSql(UpdateRec(i, 0), sCon)
Catch Ex As SqlCeException
ErrTxt = Ex.ToString
End Try
Next


Public Shared Function IsConnected() As Boolean
Dim request As HttpWebRequest
Dim response As HttpWebResponse
Try
request = CType(WebRequest.Create("http://www.intel.com/"), HttpWebRequest)
response = CType(request.GetResponse(), HttpWebResponse)
If response.StatusCode = HttpStatusCode.OK Then
response.Close()
Return True
Else
response.Close()
Return False
End If
Catch Ex As WebException
Return False
End Try
End Function

There are rda properties which determine a timeout. How can I use these to stop my program from locking up if the signal is weak?

View 1 Replies View Related

ASP.NET,Gettting Error In The Program

Jan 4, 2007

Hi,
please have look into the code and let me know the solution plz. 
string ProID;
try
{
using(SqlConnection conn=new SqlConnection(source))
{
conn.Open();
DataSet ds=new DataSet();
DDLProject.Items.Clear();
SqlCommand cmd=new SqlCommand("SP_ProjectSelect",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("Name",SqlDbType.NChar,30,"@Name");
cmd.UpdatedRowSource=UpdateRowSource.None;
cmd.Parameters["Name"].Value=DDLProductLine.SelectedItem;
 
SqlDataReader dr=cmd.ExecuteReader(); ------------->>>> Here iam getting Following Error.
 
while(dr.Read())
{ Response.Write(dr["ID"].ToString());
}
 
}
}
catch(System.Exception ex)
{
Response.Write(ex);
}
Error:
System.InvalidCastException: Object must implement IConvertible. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader() at MIS.UI.ResourceList.DDLProductLine_SelectedIndexChanged(Object sender, EventArgs e) in c:inetpubwwwrootdotnet pgmsmisui
esourcelist.aspx.cs:line 121 
Any suggestion plzz,where went wrong.
Thanks in advance
Regards
Mahesh Reddy 
 
 

View 2 Replies View Related

Use Sql 2005 To Program Against Sql 2000

May 15, 2007

I have sql server 2005 (full version) installed on my local machine, while the databases (on the server) I want to program against are in sql 2000. Could I program against sql 2000 databases using sql 2005? If yes, what do I need to know before I start doing that? Any suggestions are welcome.

View 1 Replies View Related

Problem With Update Program

May 29, 2008

 I have written this Program For Updating the profile Information .At the Page_Load Event I read the profile information from the database and write it in the respective Textboxes .At the Button_Click event I have written a program to Update the data from the respective Textboxes.The program executes but doesnot updates .public partial class CreateProfile : System.Web.UI.Page{    SqlConnection con;    SqlCommand com;    string un = HttpContext.Current.User.Identity.Name;    protected void Page_Load(object sender, EventArgs e)    {        con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Profiledata.mdf;Integrated Security=True;User Instance=True");        com = new SqlCommand("select * from profiletable where username='" + un + "' ", con);        DataSet ds = new DataSet();        SqlDataAdapter da = new SqlDataAdapter(com);        SqlCommandBuilder cb = new SqlCommandBuilder(da);        DataTable dt = new DataTable();        da.Fill(ds);        dt = ds.Tables[0];        Textname.Text = dt.Rows[0][1].ToString();        com.Cancel();    }    protected void Button2_Click(object sender, EventArgs e)    {        con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Profiledata.mdf;Integrated Security=True;User Instance=True");        con.Open();        com = new SqlCommand("update profiletable set name='" + Textname.Text + "'  where username='" + un + "' ", con);        com.ExecuteNonQuery();        com.Cancel();        con.Close();    }} Plz help me with this program........................   

View 4 Replies View Related

Rapid Program Design

Mar 8, 2001

does anyone know of tools that allow free format screen design, easily programmable data validation and prgramming for use with SQL. I am used to using 4GL languages and want to avoid low level programming. For example to fifind a record and display the details i am used to a line of code that would allow the data field to do the find on to be entered and the next line of code would say find fieldname using index name and the results displayed
please say yes !!!

View 2 Replies View Related

Get Password To Start A Program

Apr 3, 2003

I have this Visual Basic program that if you are already logged into the application, the program get the username and password automatically to run the program. If the user runs the program not logged into the application, the program prompts username and password.

I need to know the T-SQL statement that will get the username and password when the user is already logged into the application. Basically I have the username part but the password keeps coming back as NULL and will not allow program to run.

Please help.

Sharon

View 4 Replies View Related

Keyword Search Program

Sep 11, 2003

Hi,

I am in the middle of developing procedure for keyword search for our website.

Input parameter is a string consisting keywords in comma delimited format.

This is the example of data I get from business group which I use to populate my key_search table.

product_id keyword
1 Microsoft, training
1CA, DBA
1CA, developer
1CA, network admin
1AZ, DBA
1AK, developer
1MN, DBA
1MN, developer
1OH, developer
2Microsoft, training
2AZ, DBA
2AZ, developer
2IL, developer
2MN, DBA
2CA, developer
2NY, business analyst
2NY, DBA
2NY, developer
2NY, programmer
3Oracle, training
3finance
4Oracle demo
4logistic
4Oracle Financials
4Financial Analyzer

They have provided search string examples like 'Microsoft, DBA, CA'
or 'CA'
or 'Microsoft, developer' or 'training'

I have script ready to remove comma from the string and store words from the input string in a temporary table.
But this is the easiest part.

The Confusing part now for me is to write the optimal code for retrieving the exact match from the key_search table as there is no limit on how many words can be in the string, it can be 1, 2, 3 or more.

Any suggestions on how should I handle this search?

View 6 Replies View Related

Problems With SQL Server 2K And VB Program

Jun 27, 2001

Hi,
My company has recently migrated our Informix database to SQL server 2K. The data is successfully migrated and the client are able to connect to the database. However, when trying to run a VB application to access the data, it keeps on prompting for SQL server login whenever an sql statement is executed. What could be the problem? We are using SQL server 2k on Windows 2000 and on the client Windows 95. Thanks!

View 2 Replies View Related

Bulk Copy Program

Jun 11, 2004

Hi Techies,

I have a bcp which generates .txt file perfectly. I just wanted to know how can i generate a text file in distributed environment.

Assuming that my Sql Server is running in machine A. I wanted the bcp to generate in Machine B. What are the permission's i should give in order to generate it in Machine B.


Regards
--Tanveer

View 3 Replies View Related

Calling An External Program

May 19, 2004

Hi,

Is there a stored proc or a function I can call from Query Analyzer to execute another .EXE and return when it's finished?

I'd like something like
SET @RET = sp_CallEXE('c:mypathmyprogram.exe myparameters')

(Except for the name of the function, there should be something that does this right? I mean, DTS does it already so it must be referring to a function or a SP.)

I want an answer to so that I can validate that everything went well (hence the @RET variable)

Thanks,

Skip.

View 1 Replies View Related

SQL Hour Scheduling Program?

Nov 24, 2005

Does anyone know where to purchase a good (or great) SQL hour scheduler program, and pulls up information from a SQL server and puts this information into a schedule (hourly schedule). I'm looking for something that will show the schedule that people work, the information off the SQL server needed is the "agent" name. If anyone could help me, that would be greatly appreciated.

Thanks.

View 1 Replies View Related

Php Program Install Error

Jun 2, 2007

my database is 4.1. When I attempt to install i get:
'/usr/local/mysql-5.0/data/mysql.sock'
To me this indicates 5.0

I'm stumped!!!!

All help is appreciated.
Thanks

View 1 Replies View Related

MASS INSERT FROM VB.NET PROGRAM TO DB

Oct 4, 2007

I have the following problem. I need to insert 100.000 records (50Kb each) in one operation from a VB program into a SQL Server 2005 database. All of these records will be ready for inserting at the same time.
How to make this insert as one big transaction instead of 100.000 small ones?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved