execute/run/submit a JD Edwards(XE/E810/E811) UBE, Report Program using web program and sql-server:
Step 1: Create a Batch FileFirst Create a batch file (run_UBE.BAT) on Enterprise (DATABASE) , Pass parameter as Program Name & Version
CD\
i:
cd PEOPLESOFT
cd DDP
cd E810
cd system
cd bin32
SET progname=%1
SET vername=%2
RUNUBE USER PASSWORD ENVIRONMENT ROLE %1 %2 QBATCH "BATCH" "Hold" "SAVE" PRINTER_NAME
echo
EXAMPLE
RUNUBE RAJEEV PASSWORD PD810 ADMIN R42565 ZJDE0001 QBATCH "BATCH" "Hold" "SAVE" PRINTER_NAME
Step 2: Create a Stored Proc.
CREATE PROCEDURE [dbo].[runu_batch]
(@PRGNAME AS VARCHAR(15),@VERSNAME AS VARCHAR(15))
AS
DECLARE @PRGVER VARCHAR(30)
DECLARE @CMD VARCHAR(50)
SET @PRGVER= LTRIM(RTRIM(@PRGNAME))+' '+LTRIM(RTRIM(@VERSNAME))
SET @CMD ='c:\runube\run_UBE.BAT '+ @PRGVER
exec master..xp_cmdshell @CMD
GO
After that call stored proc from web program (I did in ASP.NET)
This is my Technical area of troubleshooting and learning new Programming skills and many more. Here you will find answers for many new technologies like asp.net 2.0/3.5,4.0 C# access, mysql, Amazon Webservice ,Sql-server, JD Edwards, SAS, Salesforce, APIs, MVC and many more. please visit & discuss.
Friday, March 30, 2007
ASP.NET QuickStart Tutorial
"The ASP.NET QuickStart is a series of ASP.NET samples and supporting commentary designed to quickly acquaint developers with the syntax, architecture, and power of the ASP.NET Web programming framework. The QuickStart samples are designed to be short, easy-to-understand illustrations of ASP.NET features. By the time you finish reading this tutorial, you will be familiar with the broad range of the new features in ASP.NET 2.0, as well as the features that were supported in earlier versions."
ASP.NET QuickStart Tutorial:
ASP.NET QuickStart Tutorial:
15 Seconds : N-Tier Web Applications using ASP.NET 2.0 and SQL Server 2005 - Part 1
15 Seconds : N-Tier Web Applications using ASP.NET 2.0 and SQL Server 2005 - Part 1: "N-Tier Web Applications using ASP.NET 2.0 and SQL Server 2005 - Part 1"
Xcopy - Copy files and folders
Xcopy - Copy files and folders
XCOPY
Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.Syntax
XCOPY source [destination] [options]
Key
source : Pathname for the file(s) to be copied.
destination : Pathname for the new file(s). [options] can be any combination of the following: Source Options
/A Copy files with the archive attribute set (default=Y)
/M Copy files with the archive attribute set and turn off the archive attribute, use this option when making regular Backups (default=Y) /H Copy hidden and system files and folders (default=N)
/D:mm-dd-yyyy Copy files that have changed since mm-dd-yyyy.
If no date is given, the default is to copy files with a modification date before today.
(at least 1 day before)
/U Copy only files that already exist in destination.
/S Copy folders and subfolders
/E Copy folders and subfolders, including Empty folders. May be used to modify /T.
/EXCLUDE:file1[+file2][+file3]...
(Windows 2000 only) The files can each contain one
or more full or partial pathnames to be excluded.
When any of these match any part of the absolute path
of a SOURCE file, then that file will be excluded.
For example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively. Copy Options
XCOPY
Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.Syntax
XCOPY source [destination] [options]
Key
source : Pathname for the file(s) to be copied.
destination : Pathname for the new file(s). [options] can be any combination of the following: Source Options
/A Copy files with the archive attribute set (default=Y)
/M Copy files with the archive attribute set and turn off the archive attribute, use this option when making regular Backups (default=Y) /H Copy hidden and system files and folders (default=N)
/D:mm-dd-yyyy Copy files that have changed since mm-dd-yyyy.
If no date is given, the default is to copy files with a modification date before today.
(at least 1 day before)
/U Copy only files that already exist in destination.
/S Copy folders and subfolders
/E Copy folders and subfolders, including Empty folders. May be used to modify /T.
/EXCLUDE:file1[+file2][+file3]...
(Windows 2000 only) The files can each contain one
or more full or partial pathnames to be excluded.
When any of these match any part of the absolute path
of a SOURCE file, then that file will be excluded.
For example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively. Copy Options
DOS Batch File Tutorial: Advanced Examples I
DOS Batch File Tutorial: Advanced Examples I
:: DRTD.bat:: Lists Files Made or Modified Today:: In the Current or All Directories::@ECHO OFF
C:\DOS\XSET CUR-DATE DATE MM-DD-YY
IF "%1" == "" GOTO LIST-CURIF "%1" == "\" GOTO LIST-ALL
:LIST-CURDIR *.* /O:N Find "%CUR-DATE%" MOREGOTO END
:LIST-ALLDIR \*.* /O:N /S Find "%CUR-DATE%" MORE
:ENDSET CUR-DATE=
:: DRTD.bat:: Lists Files Made or Modified Today:: In the Current or All Directories::@ECHO OFF
C:\DOS\XSET CUR-DATE DATE MM-DD-YY
IF "%1" == "" GOTO LIST-CURIF "%1" == "\" GOTO LIST-ALL
:LIST-CURDIR *.* /O:N Find "%CUR-DATE%" MOREGOTO END
:LIST-ALLDIR \*.* /O:N /S Find "%CUR-DATE%" MORE
:ENDSET CUR-DATE=
Thursday, March 29, 2007
Sending SMTP Mail using a Stored Procedure - SQL Server Information at SQLTeam.com
Sending SMTP Mail using a Stored Procedure - SQL Server Information at SQLTeam.com:
One of the downsides of SQL Mail is the fact that it is tied to a MAPI Profile. Here is a way to send email using the sp_OACreate procedure to call a third party SMTP component.
One of the downsides of SQL Mail is the fact that it is tied to a MAPI Profile. Here is a way to send email using the sp_OACreate procedure to call a third party SMTP component.
Selecting a subfolder from a particular folder - The Code Project - Files and Folders
Selecting a subfolder from a particular folder - The Code Project - Files and Folders: "Selecting a subfolder from a particular folder"
Downloading any file to the browser - Part II: using ASP.NET | xefteri.com
Downloading any file to the browser - Part II: using ASP.NET xefteri.com: "Downloading any file to the browser - Part II: using ASP.NET"
Creating ASP.NET Photo Album using FileSystem as Data
"Creating ASP.NET Photo Album using FileSystem as Data"
xp_cmdshell
Why is it that you can pass a built string to xp_cmdshell but you can't build your string at the same time. What I mean is this:
This is legal:
DECLARE @cmd VARCHAR(255)DECLARE @ServerName SYSNAME
SET @ServerName = 'Server1'SET @cmd = 'copy C:\temp\test.txt \\ + @ServerName + '\SomeShare\'
EXEC master.dbo.xp_cmdshell @cmd
This is legal:
DECLARE @cmd VARCHAR(255)DECLARE @ServerName SYSNAME
SET @ServerName = 'Server1'SET @cmd = 'copy C:\temp\test.txt \\ + @ServerName + '\SomeShare\'
EXEC master.dbo.xp_cmdshell @cmd
A parameter is any value passed into a batch script:
parameters: "A parameter is any value passed into a batch script:"
Syntax : Parameters
A parameter is any value passed into a batch script:
C:> MyScript.cmd January 1234 "Some value"
Parameters may also be passed to a subroutine with CALL:
CALL :my_sub January 1234 "Some value"
Getting the value of a parameterYou can get the value of any parameter using a % followed by it's numerical position on the command line. i.e.The first item passed is always %1 the second item is always %2 and so on
It is often a good idea to set a variable equal to the parameter, if only to give things easy to read names
SET _MonthPassed=%1
%* in a batch script refers to all the arguments (e.g. %1 %2 %3 %4 %5 ...%255)
Filename Parameter ExtensionsIf a parameter is used to supply a filename then the following extended syntax can be applied: we are using the variable %1 (but this works for any parameter)%~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt%~d1 - expands %1 to a Drive letter only - C:%~p1 - expands %1 to a Path only - \utils\%~n1 - expands %1 to a file Name, or if only a path is present - the last folder in that path%~x1 - expands %1 to a file eXtension only - .txt%~s1 - changes the meaning of f, n and x to reference the Short nameAdditional parameter extensions available in Win2K / XP: %~1 - expand %1 removing any surrounding quotes (")
%~a1 - display the file attributes of %1
%~t1 - display the date/time of %1
%~z1
Syntax : Parameters
A parameter is any value passed into a batch script:
C:> MyScript.cmd January 1234 "Some value"
Parameters may also be passed to a subroutine with CALL:
CALL :my_sub January 1234 "Some value"
Getting the value of a parameterYou can get the value of any parameter using a % followed by it's numerical position on the command line. i.e.The first item passed is always %1 the second item is always %2 and so on
It is often a good idea to set a variable equal to the parameter, if only to give things easy to read names
SET _MonthPassed=%1
%* in a batch script refers to all the arguments (e.g. %1 %2 %3 %4 %5 ...%255)
Filename Parameter ExtensionsIf a parameter is used to supply a filename then the following extended syntax can be applied: we are using the variable %1 (but this works for any parameter)%~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt%~d1 - expands %1 to a Drive letter only - C:%~p1 - expands %1 to a Path only - \utils\%~n1 - expands %1 to a file Name, or if only a path is present - the last folder in that path%~x1 - expands %1 to a file eXtension only - .txt%~s1 - changes the meaning of f, n and x to reference the Short nameAdditional parameter extensions available in Win2K / XP: %~1 - expand %1 removing any surrounding quotes (")
%~a1 - display the file attributes of %1
%~t1 - display the date/time of %1
%~z1
Wednesday, March 28, 2007
How to launch Windows applications (Notepad) / Call Batch files from a C#/.NET console application. - The Code Project - C# Programming
How to launch Windows applications (Notepad) / Call Batch files from a C#/.NET console application. - The Code Project - C# Programming: "How to launch Windows applications (Notepad) / Call Batch files from a C#/.NET console application."
ASP.NET.4GuysFromRolla.com: Searching Your Website with Microsoft Index Services
"Searching Your Website with Microsoft Index Services"
IntroductionVirtually every Web application has a search functionality, from big eCommerce sites like Amazon.com, down to small blogs or personal sites that might have only a handful of pages. Search has become so ubiquitous that when visitors to your site want to find some past article they read, they'll immediately start hunting for the search capability.
From the website developer's perspective, providing search capabilities requires two steps:
First, you must create an index of the site's contents. An index of a website is synonymous to the index in a book. If you want to read about a particular topic in the book you can quickly find the page(s) through the index, as opposed to having to read through the book's entire contents.
Once an index has been created you need to be able to search through the index. Essentially, a user will enter a search string and you'll need to find the matching, relevant results in the index, displaying them to the user.
IntroductionVirtually every Web application has a search functionality, from big eCommerce sites like Amazon.com, down to small blogs or personal sites that might have only a handful of pages. Search has become so ubiquitous that when visitors to your site want to find some past article they read, they'll immediately start hunting for the search capability.
From the website developer's perspective, providing search capabilities requires two steps:
First, you must create an index of the site's contents. An index of a website is synonymous to the index in a book. If you want to read about a particular topic in the book you can quickly find the page(s) through the index, as opposed to having to read through the book's entire contents.
Once an index has been created you need to be able to search through the index. Essentially, a user will enter a search string and you'll need to find the matching, relevant results in the index, displaying them to the user.
ASP.NET.4GuysFromRolla.com: Working with Databases in ASP.NET 2.0 and Visual Studio 2005
ASP.NET.4GuysFromRolla.com: Working with Databases in ASP.NET 2.0 and Visual Studio 2005: "Working with Databases in ASP.NET 2.0 and Visual Studio 2005 "
CodeSnip: Calling a Stored Procedure from ASP.NET 2.0: ASP Alliance
Protected Sub Btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn1.Click
Dim sConnStr As String = {MyConnectionString} Dim cnBKTest As New SqlConnection(sConnStr) Dim cmdTest As New SqlCommand("Insert_Test", cnBKTest)
cmdTest.CommandType = Data.CommandType.StoredProcedure
cmdTest.Parameters.Add(New SqlParameter("@TestParam", Data.SqlDbType.VarChar, 10)) cmdTest.Parameters("@TestParam").Value = "Testing"
cnBKTest.Open() cmdTest.ExecuteNonQuery() cnBKTest.Close()
End Sub
Dim sConnStr As String = {MyConnectionString} Dim cnBKTest As New SqlConnection(sConnStr) Dim cmdTest As New SqlCommand("Insert_Test", cnBKTest)
cmdTest.CommandType = Data.CommandType.StoredProcedure
cmdTest.Parameters.Add(New SqlParameter("@TestParam", Data.SqlDbType.VarChar, 10)) cmdTest.Parameters("@TestParam").Value = "Testing"
cnBKTest.Open() cmdTest.ExecuteNonQuery() cnBKTest.Close()
End Sub
How can I execute .exe and batch files in server from stored procedure
SQL Server Forums - Exe files: "How can I execute .exe and batch files in server from stored procedure"
exec master..xp_cmdshell 'c:\sqlcommand.cmd'
exec master..xp_cmdshell 'c:\sqlcommand.cmd'
Tuesday, March 27, 2007
4GuysFromRolla.com - Syndicating Your Web Site's Content with RSS
4GuysFromRolla.com - Syndicating Your Web Site's Content with RSS: "Syndicating Your Web Site's Content with RSS "
Transpose sql
declare @MaxDebtNr integer
select @MaxDebtNr = max(cnt) from (select name, count(*) cnt from MyTable group by Name) x
declare @MySQL varchar(8000)
set @MySQL = 'select name'
declare @i integer
set @i = 1
while @i <= @MaxDebtNr begin set @MySQL = @MySQL + ',max(case when DebtNr = ' + cast(@i as varchar(3)) + ' then DebtID end) as DebtID' + cast(@i as varchar(3)) set @i = @i + 1 end set @MySQL = @MySQL + ' from (select a.Name, a.DebtID, count(*) DebtNr from MyTable a join MyTable b on a.Name = b.Name and a.DebtID >= b.DebtID
group by a.Name, a.DebtID
) sub group by name'
exec (@MySQL)
SELECT LIPQOH,* FROM PRODDTA.F41021 WHERE LIPQOH>0 AND LIITM>1500000
select sdso02,sdnxtr,sdlttr,* from proddta.f4211 where sddoco=389665 and sdlitm='1606018'
F98950
ALTER PROCEDURE [DBO].[SCOWNEREP]
@Itno as varchar(25)='1609463'
AS
select
' '+rtrim(CICMPID)+'' "Certificate No",
citno "Item No",CIOWNO "Owner No",CISHDT "Ship Date",CIPRDCTR "Prod Ctr" ,
CIAMRNO1 AMD1, CIAMRCM1 "AMD Com" ,CIAMRNO2 AMD2, CIAMRCM2 "AMD Com",CIAMRNO3 AMD3, CIAMRCM3 "AMD Com",
CIAMRNO4 AMD4, CIAMRCM4 "AMD Com",CIAMRNO5 AMD5, CIAMRCM5 "AMD Com",CICMPID
from jde_rk.dbo.SCCERINFODET where citno=@Itno
GO
select @MaxDebtNr = max(cnt) from (select name, count(*) cnt from MyTable group by Name) x
declare @MySQL varchar(8000)
set @MySQL = 'select name'
declare @i integer
set @i = 1
while @i <= @MaxDebtNr begin set @MySQL = @MySQL + ',max(case when DebtNr = ' + cast(@i as varchar(3)) + ' then DebtID end) as DebtID' + cast(@i as varchar(3)) set @i = @i + 1 end set @MySQL = @MySQL + ' from (select a.Name, a.DebtID, count(*) DebtNr from MyTable a join MyTable b on a.Name = b.Name and a.DebtID >= b.DebtID
group by a.Name, a.DebtID
) sub group by name'
exec (@MySQL)
SELECT LIPQOH,* FROM PRODDTA.F41021 WHERE LIPQOH>0 AND LIITM>1500000
select sdso02,sdnxtr,sdlttr,* from proddta.f4211 where sddoco=389665 and sdlitm='1606018'
F98950
ALTER PROCEDURE [DBO].[SCOWNEREP]
@Itno as varchar(25)='1609463'
AS
select
' '+rtrim(CICMPID)+'' "Certificate No",
citno "Item No",CIOWNO "Owner No",CISHDT "Ship Date",CIPRDCTR "Prod Ctr" ,
CIAMRNO1 AMD1, CIAMRCM1 "AMD Com" ,CIAMRNO2 AMD2, CIAMRCM2 "AMD Com",CIAMRNO3 AMD3, CIAMRCM3 "AMD Com",
CIAMRNO4 AMD4, CIAMRCM4 "AMD Com",CIAMRNO5 AMD5, CIAMRCM5 "AMD Com",CICMPID
from jde_rk.dbo.SCCERINFODET where citno=@Itno
GO
Running Total SQL-Server
DATA
OrderID OrderAmt OrderDate
----------- ---------- --------------------
1 10.50 2003-10-11 08:00:00
2 11.50 2003-10-11 10:00:00
3 1.25 2003-10-11 12:00:00
4 100.57 2003-10-12 09:00:00
5 19.99 2003-10-12 11:00:00
6 47.14 2003-10-13 10:00:00
7 10.08 2003-10-13 12:00:00
8 7.50 2003-10-13 19:00:00
9 9.50 2003-10-13 21:00:00
---------------------------
select O.OrderId,
convert(char(10),O.OrderDate,101) as 'Order Date',
O.OrderAmt,
(select sum(OrderAmt) from Orders
where OrderID <= O.OrderID and
convert(char(10),OrderDate,101)
= convert(char(10),O.OrderDate,101))
'Running Total'
from Orders O
order by OrderID
--------------------------------------
select O.OrderID,convert(char(10),O.OrderDate,101) 'Order Date',O.OrderAmt,
case when OrderID = (select top 1 OrderId from Orders
where convert(char(10),OrderDate,101)
= convert(char(10),O.OrderDate,101)
order by OrderID desc)
then (select cast(sum(OrderAmt) as char(10))
from Orders
where OrderID <= O.OrderID
and convert(char(10),OrderDate,101)
= convert(char(10),O.OrderDate,101))
else ' ' end as 'Sub Total',
case when OrderID = (select top 1 OrderId from Orders
order by OrderDate desc)
then (select cast(sum(OrderAmt) as char(10))
from Orders)
else ' ' end as 'Grand Total'
from Orders O
order by OrderID
OrderID OrderAmt OrderDate
----------- ---------- --------------------
1 10.50 2003-10-11 08:00:00
2 11.50 2003-10-11 10:00:00
3 1.25 2003-10-11 12:00:00
4 100.57 2003-10-12 09:00:00
5 19.99 2003-10-12 11:00:00
6 47.14 2003-10-13 10:00:00
7 10.08 2003-10-13 12:00:00
8 7.50 2003-10-13 19:00:00
9 9.50 2003-10-13 21:00:00
---------------------------
select O.OrderId,
convert(char(10),O.OrderDate,101) as 'Order Date',
O.OrderAmt,
(select sum(OrderAmt) from Orders
where OrderID <= O.OrderID and
convert(char(10),OrderDate,101)
= convert(char(10),O.OrderDate,101))
'Running Total'
from Orders O
order by OrderID
--------------------------------------
select O.OrderID,convert(char(10),O.OrderDate,101) 'Order Date',O.OrderAmt,
case when OrderID = (select top 1 OrderId from Orders
where convert(char(10),OrderDate,101)
= convert(char(10),O.OrderDate,101)
order by OrderID desc)
then (select cast(sum(OrderAmt) as char(10))
from Orders
where OrderID <= O.OrderID
and convert(char(10),OrderDate,101)
= convert(char(10),O.OrderDate,101))
else ' ' end as 'Sub Total',
case when OrderID = (select top 1 OrderId from Orders
order by OrderDate desc)
then (select cast(sum(OrderAmt) as char(10))
from Orders)
else ' ' end as 'Grand Total'
from Orders O
order by OrderID
JD Edwards Date Operation
--Normal Date to Julian Date
declare @rpdivj as int
declare @datea as datetime
set @rpdivj='102015'
set @datea= DATEADD(dy, @rpdivj % 1000, DATEADD(yy, @rpdivj / 1000,-1))
print DATEADD(dy, @rpdivj % 1000, DATEADD(yy, @rpdivj / 1000, -1))
print DATEPART(month, @datea)
print DATEPART(day, @datea)
print DATEPART(year, @datea)
--Julian Date to Normal Date
declare @y as varchar(10)
declare @dy as varchar(10)
declare @date1 as datetime
declare @szupmj as varchar(10)
set @date1= getdate()--'10/01/02'
-- set @date1= '10/1/2002'
set @y =(datepart(yy,@date1) - 1900) * 1000;
set @dy = datepart(dy,@date1);
set @szupmj = @y + cast(@dy as int);
print 'Date ====>>> '+ @szupmj
in Select Statement
DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1))
select (datepart(yy,getdate()) - 1900) * 1000+ cast(datepart(dy,getdate())as int)
select CONVERT(CHAR(15),GETDATE(),101)
declare @rpdivj as int
declare @datea as datetime
set @rpdivj='102015'
set @datea= DATEADD(dy, @rpdivj % 1000, DATEADD(yy, @rpdivj / 1000,-1))
print DATEADD(dy, @rpdivj % 1000, DATEADD(yy, @rpdivj / 1000, -1))
print DATEPART(month, @datea)
print DATEPART(day, @datea)
print DATEPART(year, @datea)
--Julian Date to Normal Date
declare @y as varchar(10)
declare @dy as varchar(10)
declare @date1 as datetime
declare @szupmj as varchar(10)
set @date1= getdate()--'10/01/02'
-- set @date1= '10/1/2002'
set @y =(datepart(yy,@date1) - 1900) * 1000;
set @dy = datepart(dy,@date1);
set @szupmj = @y + cast(@dy as int);
print 'Date ====>>> '+ @szupmj
in Select Statement
DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1))
select (datepart(yy,getdate()) - 1900) * 1000+ cast(datepart(dy,getdate())as int)
select CONVERT(CHAR(15),GETDATE(),101)
Free online flash menu generator, drop down flash menu
Free online flash menu generator, drop down flash menu: "Free online flash menu generator. "
DHTML: Draw Line, Ellipse, Oval, Circle, Polyline, Polygon, Triangle with JavaScript
DHTML: Draw Line, Ellipse, Oval, Circle, Polyline, Polygon, Triangle with JavaScript: "DHTML, JavaScript
Draw Line, Circle, Ellipse (Oval), Polyline, Polygon, Rectangle.
High Performance JavaScript Vector Graphics Library."
Draw Line, Circle, Ellipse (Oval), Polyline, Polygon, Rectangle.
High Performance JavaScript Vector Graphics Library."
Sunday, March 25, 2007
An ASP.NET Xml DropDown Menu UserControl
An ASP.NET Xml DropDown Menu UserControl: "An ASP.NET Xml Custom Dropdown Menu UserControl "
Saturday, March 24, 2007
Run external programs from SQL Server stored procedures - The Code Project - Database
Run external programs from SQL Server stored procedures - The Code Project - Database: "Run external programs from SQL Server stored procedures"
Stored procedure: Execute T-SQL code from a file
Stored procedure: Execute T-SQL code from a file
EXECUTE sp_ExecuteSQLFromFile 'D:\Scripts\Script.sql',NULL,1
EXECUTE sp_ExecuteSQLFromFile 'D:\Scripts\Script.sql',NULL,1
Thursday, March 22, 2007
Brendan Tompkins : Run a .BAT file from ASP.NET
Brendan Tompkins : Run a .BAT file from ASP.NET: "Run a .BAT file from ASP.NET
Okay, running .BAT files from ASP.NET using the System.Diagnostics.Process object and static methods this should be easy, right? Well, this might work for you, but it certainly won't work on my machines. And after doing lots of reasearh on the issue, it seems that other people are also having problems with this too.
I wrestled with permissions and all sorts of other stuff, trying to get a simple batch file to run, with no luck. I tried lauching the bat file directly, launching cmd.exe and calling the bat file using stin. No dice. It seems that something on my machine was keeping an unattended process from running bat files. This makes sense, but I was never able to pinpoint what was preventing this, so I came up with a workaround.
I realized that since I could sucessfully run cmd.exe, and send commands to it via stin, I could just open the batch file, and send each line to cmd.exe, which is essentially the same as running a batch file itself. This technique works great, and I thought I'd pass along the code here."
Okay, running .BAT files from ASP.NET using the System.Diagnostics.Process object and static methods this should be easy, right? Well, this might work for you, but it certainly won't work on my machines. And after doing lots of reasearh on the issue, it seems that other people are also having problems with this too.
I wrestled with permissions and all sorts of other stuff, trying to get a simple batch file to run, with no luck. I tried lauching the bat file directly, launching cmd.exe and calling the bat file using stin. No dice. It seems that something on my machine was keeping an unattended process from running bat files. This makes sense, but I was never able to pinpoint what was preventing this, so I came up with a workaround.
I realized that since I could sucessfully run cmd.exe, and send commands to it via stin, I could just open the batch file, and send each line to cmd.exe, which is essentially the same as running a batch file itself. This technique works great, and I thought I'd pass along the code here."
List all available databases on SQL Server
List all available databases on SQL Server: "List all available databases on SQL Server
This code snippet will show you how to list all available databases on a SQL Server box. The trick here is to query master..sysdatabases"
select * from master..sysdatabases
This code snippet will show you how to list all available databases on a SQL Server box. The trick here is to query master..sysdatabases"
select * from master..sysdatabases
Cry How To - List all tables
Cry How To - List all tables: "List all tables
To get a list of all the tables in a SQL Server database, use either:
sp_tables
or alternately to list only the user tables use:
select name, user_name(uid) from sysobjects where type='U'"
To get a list of all the tables in a SQL Server database, use either:
sp_tables
or alternately to list only the user tables use:
select name, user_name(uid) from sysobjects where type='U'"
FTP: Setting Up Windows NT 4.0, 2000, or XP Workstations to Accept FTP Transfers
FTP: Setting Up Windows NT 4.0, 2000, or XP Workstations to Accept FTP Transfers: "Configuring the FTP Server
On the desktop, double-click My Computer, then double-click the hard drive on which you have Windows installed.
Open the folder inetpub. Right-click the ftproot folder and select Properties.
Click the Sharing tab. Select the radio button Share this folder, then click Permissions. From the list that appears, select Everyone, and then click Remove.
Click the Add... button. In the drop-down list, select your computer's name. In the list of user groups that appears in the center scroll box, select Users, then click Add, followed by OK. In the Permissions window, set the access level. If a user only needs to download files from your computer, set the access to Read. To give upload permission, also check Change. Click OK.
Create User accounts for each of the individuals who will need to access your server. You can do so by opening the Control Panel, then double-clicking the Users and Passwords icon. For each user, you will need to provide a username and domain.
In the main Control Panel window, double-click Administrative Tools, then double-click the Computer Management icon. A new window will open. On the left, beside Services and Applications, click the + (plus sign), and then click the + (plus sign) beside Internet Information Services.
Right-click Default FTP server and select Properties. Under 'Services', make sure that Allow anonymous connections is not checked. This will prevent unauthorized access to your workstation. Click OK, then close all windows."
On the desktop, double-click My Computer, then double-click the hard drive on which you have Windows installed.
Open the folder inetpub. Right-click the ftproot folder and select Properties.
Click the Sharing tab. Select the radio button Share this folder, then click Permissions. From the list that appears, select Everyone, and then click Remove.
Click the Add... button. In the drop-down list, select your computer's name. In the list of user groups that appears in the center scroll box, select Users, then click Add, followed by OK. In the Permissions window, set the access level. If a user only needs to download files from your computer, set the access to Read. To give upload permission, also check Change. Click OK.
Create User accounts for each of the individuals who will need to access your server. You can do so by opening the Control Panel, then double-clicking the Users and Passwords icon. For each user, you will need to provide a username and domain.
In the main Control Panel window, double-click Administrative Tools, then double-click the Computer Management icon. A new window will open. On the left, beside Services and Applications, click the + (plus sign), and then click the + (plus sign) beside Internet Information Services.
Right-click Default FTP server and select Properties. Under 'Services', make sure that Allow anonymous connections is not checked. This will prevent unauthorized access to your workstation. Click OK, then close all windows."
Friday, March 16, 2007
Subscribe to:
Posts (Atom)