Running .sql File
Sep 11, 2005i am creating a few dynamic tables and views , is there a way to execute a .sql file from asp.net (vb.net) ?
View 2 Repliesi am creating a few dynamic tables and views , is there a way to execute a .sql file from asp.net (vb.net) ?
View 2 RepliesIn my environment, there is maintenance plan configured on one of the server and while running DBCC checkdb on a database of size around 200GB, log file usage of tempdb is increasing and causing the maintenance job to fail.
What can I do to make the maintenance job run successfully, size of the tempdb database is only 50GB and recovery model is set to simple. It cannot be increased as the mount point on which it is residing is 50GB.
how can a .sql file (containing script for creating tables etc.) be run in Sql Query Analyzer through VB.
The ultimate task is to create database in sql server 7.0 through VB.
thanks,
Sumit
Hi
Is it possible using T-SQL to run a batch file located on different server, ie. PC1 has SQL Server on it, PC2 has the batchfile, I need to run the batchfile stored on PC2 on PC1.
Thanks
Hi
I am trying to run a batch file stored on different server from the one that SQL Server is on using T-SQL. I am using the following syntax:
EXEC master..XP_CMDShell '\hit1DEVArchivingArchivingDataFiles.zipdata.bat'
But it doesnt seem to be working, it states that it is not recognised as an internal or external command.
Any ideas?
Thanks
can anyone tell me how to run the sql server script file saved on my disk through .net code and get the changes done in the database?
Hi guys,
I am a new person to sql. I wanted to know how you execute a script file in Query analyzer.
and also I wanted to know how you get the output to a file.
Thanks for the help . Please I need this info asap.
Exec master..xp_cmdshell "bcp sdnetpro..nbtorder11 out d:databtorder11.txt /c /t /Sservername /Usa /Ppassword"
Hi, this code run fine from within sql server query window. I want to put this code in a batch file and run the batch file.. it did not work. someone told me the revised code is :
bcp sdnetpro..nbtorder11 out d:databtorder11.txt /c /t,/r -Sservername -Usa -Ppassword"
This is not working. Please if anyone knows how to fix this, I would appreciate. One more thing, how can I confirm that the bcp has successfully done. do I have to create a log file and if so what is the code to create this log file.
thanks
Ali
Hi All,
I've been trying to find the answer but been unable to. My question is it possible to create a SQL Server (2005) database in a usb2 drive? I have a large usb drive that i would like to store my database into instead of my local drive which is not that big.
Thanks
HiI have a VBScript file which runs fine when I click it or when I run itfrom a command prompt level.I added it as the 1st step of an SqlServer job and the job always failswith the error message"Executed as user: GVIANTAdministrator. The process could not becreated for step 1 of job 0xBE3A0405EB9F624282C1A9474AA9F719 (reason: %1is not a valid Win32 application). The step failed."Cn anyone help me understanding this error message.Thanks 1David Greenberg
View 2 Replies View RelatedI am currently SQL admin since our ordinary SQL folks are at summer vacation.
Yesterday SCOM alerted that File Group is running out of space on one not so critical database "The file group "PRIMARY" for the database "loganalys" in SQL instance "MSSQLSERVER" on computer "sqlserver2" is running out of space".
I logged in to the SQL server and checked the database in question. It is a very large DB with a size of 577 GB.The storage on which the database files resides has 123 GB free space so that isn't the issue.
The database is set to autogrowth 1 MB at a time (unrestricted) so that doesn't seem to be the issue either.However, in the database properties under General, it says Space avaliable: 570 MB.
I guess that this may be the issue, that this is under some treshold for SCOM to alert on.I have looked at the other databases and they have everything between 0,25MB to 270MB space avaliable (they are all set to autogrowth 1 MB, unrestricted).
I am not sure what this means and if I have to do something about it?
Hello,
I am looking for some way to run a sql query from a batch file on the SQL server. The query needs a user entered parameter, if that can be accomodated it would be great.
I read about some osql command & tried to run it but it kept saying "Server does not exist or access denied."
Please give me the steps to go about this.
Thanks,
-R
I am try to run a .sql file
CREATE VIEW LastReport
AS
SELECT MAX(ID) AS LastReport, RHost
FROM Report
WHERE (RComplete = 1)
GROUP BY RHost
CREATE PROCEDURE [dbo].[MembresAcces_Insert]
AS
INSERT INTO membresAcces (login, passe, id_membresTypes) VALUES ('admin','admin',50);
.... 10 view and procedure like this one
i get an error view must be the first one
what is wrong ? running CREATE TABLE works perfectly
thank you
Hi All,
How can I run a host command (OS command ) from ".sql" script of sql server?
-- Rajesh
Is there a way to run/call a batch file from a stored procedure?
Or, is there a way to run/call a batch file from a trigger?
My intention is to include a sql job to schedule for shrinking log files to half of its original log file size (if half of their original size is greater than 5MB)
The code is below. But while executing the code it is keeps on running indefinitely. can somebody throw some light what cause it to go into an indefinite loop.
Thanks
Babu
code:
====
DECLARE db_file_name CURSOR FOR
SELECT name , ceiling(size/128.0) * 0.5
FROM master..sysaltfiles
Where rtrim(lower(filename)) like '%.ldf'
DECLARE @f_name varchar(128), @new_f_size int
OPEN db_file_name
FETCH NEXT FROM db_file_name INTO @f_name,@new_f_size
WHILE @@FETCH_STATUS = 0
BEGIN
If ( @new_f_size > 5)
BEGIN
DBCC SHRINKFILE ( @f_name, @new_f_size )
FETCH NEXT FROM db_file_name INTO @f_name,@new_f_size
END
END
CLOSE db_file_name
deallocate db_file_name
We are receiving following alerts frequently about 1:40 AM in the morning. We have backups running on 11:00 PM everyday and rebuild job running at 2:00 AM. Not sure the exact cause of this error.
Error:
The file group "PRIMARY" for the database "tempdb" in SQL instance "MSSQLSERVER" on computer "XYZ" is running out of space.
tempdev Initial size : 133,100 MB Growth: By 10 percent, Limited to 140000 MB
templog Initial Size : 5,475 MB Growth: By 10 percent, Unlimited
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.
HI,
I am creating a custom control flow component in SSIS. The work flow of this component is to connect to File conection manager and after selecting the file it set properties of the file to variables. When i am runnning this component in SSIS , one method is calling i.e SAVETOXML. Here i am saving selected properties of the file to XMLby using XMLELEMent attribute. Its running fine. Here my question is where i can get that XML file. Where it is saving that XML file. From where i can Load that XML file. What is the use of LOADXML method.
Thanks in advance
ashok mohanty
What do I need to stop this error?
Started: 5:05:48 PM
Error: 2014-08-21 17:05:50.64
Code: 0xC000F427
Source: File System Task
Description: To run a SSIS package outside of SQL Server Data Tools you must install File System Task of Integration Services or higher.
End Error
Hi there,I have a data manipulation process written in a Nested Stored procedurethat have four levels deeper. When I run these individual proceduresindividually they all seems to be fine. Where as when I run them alltogether as Nested proces (calling one in another as sub-procedures) Logfile is growing pretty bad like 25 to 30GB.. and finally getting kickedafter running disk space. This process is running around 3hrs on a SQLserever Standard Box having dual processer and 2gb ram.This procedures have bunch of bulk updates and at least one cursor ineacch procedure that gets looped through.I was wondering if anybody experienced this situation or have any clueas to why is this happening and how to resolve this?I am in a pretty bad shape to deliver this product and in need of urgenthelp.Any ideas would be greatly appreciated..Thanks in advance*** Sent via Developersdex http://www.developersdex.com ***
View 1 Replies View RelatedHi,I have dumped a very large database from mysql (using mysqldump program)as a raw sql file. The reason was, convert this database to a MSSQLdatabase. Since mysqldump creates the file as raw sql file with thedatabase-table structures and the data in it, I thought using OSQL commandline utilities should work to out this whole database in MSSQL server.I have run this command from command line:osql -u sa -i mysqldump.sqlIt is going since yesterday. It has been almost 36 hours that it'sstarted. And in the mssql server, I see no database created yet. On thescreen of the command line, I see bunch of numbers are going in order. Iassume they are row numbers of the tables processed. But, if it is doing it,then where is it saving all this data ? I have checked the tempdb, pub db,other dbs, and I see no tables related to the database I am inserting. Willit populate it at the and of the job ? Or, am I doing something wrong here?Regards.Murtix.
View 2 Replies View RelatedWe try to run a stored procedure in management studio - and we see the following error -
"
Executed as user: "Some User". Unspecified error occurred on SQL Server. Connection may have been terminated by the server.
[SQLSTATE HY000] (Error 0) The log for database 'Some-database' is not available.
Check the event log for related error messages.
Resolve any errors and restart the database.
[SQLSTATE HY000] (Error 9001) During undoing of a logged operation in database 'Some-Database', an error occurred at log record ID (2343114:16096:197).
Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.
[SQLSTATE HY000] (Error 3314) During undoing of a logged operation in database 'Some-Database', an error occurred at log record ID (2342777:81708:1).
Typically, the specific failure is logged previously as an error in the Windows Event Log service.
Restore the database or file from a backup, or repair the database. [SQLSTATE HY000] (Error 3314). The step failed.
Hi,
I have a SQL Server Agent job set up to run a job that calls a dts package on the server.
When I run the DTS Package manually, everything works fine and does what it is supposed to do.
When I run the job, The job fails. If somebody had this error can you please help me out
I am getting following error in my job...
DTSRun: Loading...Error: -2147287038 (80030002);
Provider Error: 0 (0)
Error string: The system cannot find the file specified. Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts.hlp
Help context: 713.
Process Exit Code 1. The step failed.
could you please let me know what is the possible cause for the above error.
Many Thanks,
Madhu
Hello,
I have created a package that runs without problem.
I run the package with the command dtexec /F "package_name.dtsx" > package_name.txt.
Then I run the same package from SQL Server Agent, everything is OK
Then, I tried to edit the command line to have the output file, but I got an error.
The command line is:
dtexec /F "package_name.dtsx" MAXCONCURRENT "-1" / CHECKPOINTING OFF /REPORTING E > package_name.txt.
(MAXCONCURRENT "-1" / CHECKPOINTING OFF /REPORTING E are created by default)
How can I do?
Thank
I'm trying to call WinSCP in a SSIS Execute Process Task using a .bat file to automate. SSIS is returning a generic failure error message ("Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "MyServerC$Program Files (x86)WinSCPWinSCP.exe" "-script=MyNASShareWinSCPFTP.bat " at "", The process exit code was "1" while the expected was "0"."). So now I'm trying to run the .bat file by itself. Unfortunately, the command prompt rushes by so fast that I can't see what the server is doing.
I can't find anything on the WinSCP site that indicates how to slow down the .bat file processing or log the remote server responses. I do see how to use the /log switch when using the interactive command line console, but that's not what I want to do.
We are receiving following alerts frequently about 1:40 AM in the morning. We have backups running on 11:00 PM everyday and rebuild job running at 2:00 AM. Not sure the exact cause of this error.
Error:
The file group "PRIMARY" for the database "tempdb" in SQL instance "MSSQLSERVER" on computer "XYZ" is running out of space.
tempdev Initial size : 133,100 MB Growth: By 10 percent, Limited to 140000 MB
templog Initial Size : 5,475 MB Growth: By 10 percent, Unlimited
I've written a small dos batch script that runs a simple query throughosql and then calls an exe which sends an email if the returned value
Quote:
We are running SQL 7 on a Windows NT Server. If you copy a 25Mb filefrom this machine to a W2K server, the file copy takes over 5 minuteson a 100Mpbs switched network.Copying the same file to another NT server takes only seconds, andcopying the same file to the W2K server from the 2nd NT server, (whichis not running SQL) takes only seconds also.Has anyone any ideas as to why file copying between this machine and aW2K one will take so long. It is repliacted on 5 further w2K machines.
View 1 Replies View RelatedI recently installed standalone version of SQL 2014 Standard on my work computer. I used Access before but I want to use a SQL server instead.
We have a shared drive that a file gets deposited every day at midnight. I want to be able to get this file and import it to the server (its basically a list of names).
Here what I have done so far:
I created the database
Created the file and successfully imported data into it using the Import Data feature.
I saved the SSIS package
Scheduled an Agent Job for this package to run at certain time,daily
At first the jobs would fail with a Access is Denied. I added a user under Credentials with my network account ( have admin rights on the work computer).Also added a Proxy for the Credential user I made.
Jobs fail with a “Cannot open data file” error. I tried changing things here and there, but I can’t get it to work.
I have create a batch file to execute a stored proc to import data.
When I run it from the server (Remote Desktop) it works fine, but if I share the folder and try to run it from my pc, it doesn't do anything. I don't get an error, it just doesn't do anything. My windows user has admin rights in SQL. Why is it not executing from my PC?
Hi,
I created a SSIS package which will generate an output file and place it on a remote fileshare location which will look something like this
\RemoteServerNameRemoteFilePath
The package is executing fine when I am executing it through BIDS or through execute package utility and writing the output file to remote file share location.
I created a SQL job for the package and ran the Job. Then, its throwing an error saying
Executed as user: DomainUser. Microsoft (R) SQL Server Execute Package Utility Version 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 10:33:06 AM Error: 2008-03-10 10:33:22.22 Code: 0xC020200E Source: DFT_Generate Output File Description: Cannot open the datafile "
\RemoteServerNameRemoteFilePathOutputFileName.txt". End Error Error: 2008-03-10 10:33:22.34 Code: 0xC004701A Source: DFT_Generate Output File DTS.Pipeline Description: component "FF_DST_Output" (160) failed the pre-execute phase and returned error code 0xC020200E. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 10:33:06 AM Finished: 10:33:22 AM Elapsed: 15.891 seconds. The package execution failed. The step failed.
DomainUser have all the permissions on the remote file share location.
SQL server agent is running with the log-on account DomainUser(same as the above).
Could anyone help me in resolving this issue.
Thanks & Regards,
Sriram.
Here's a challenge that is killing me:I've got 2 web servers and a SQL Server and about 5,000 'users' whostay connected to the site all day. I have a page that is supposed tobe 'real-time', so to do this, I have a 1px frame that refreshes every15 seconds (so the other frame doesn't have to reload all the time--thetop only reloads when a new record or a changed record hits the db).The real time data can be filtered in about 8 different ways.Currently, I have each user querying a table that contains 1 record,including the max ID and the most current insert/update posting date.The browser contains a cookie with that date. When the browser receivesnotification that there is some new info on the server, it refreshesthe top page and reloads the data. This is happening for all users. So,I thought to eliminate the 5,000 users running the same (or closevariations) of the same query each time a records is inserted/updated,that I would generate an XML file with the current day's data.In a dev environment this works 'ok'. I'm doing this by running anActiveX job on the SQL Server that calls a stored proc (FOR XML) andwrites the content to a file. Then from the web servers, I'm queryingthis file for the new timestamp and then if newer than the cookie,grabbing the XML (using the httprequest in the ASP XMLDOM) and usingXSLT to transform the data instead of parameterizing the queries.Theoretically I love this solution. Problems happen in a LIVEenvironment where either the file is being written to or the job isn'table to run. When 2 records are trying to be written within the samesecond, the file isn't being written (or maybe that the http requestingthe XML is keeping the file locked?)....anyway...this is a HUGE problethat I can't seem to solve. Once we roll to .NET I think storing thedataset in cache and updating cache (still don't know how I'll triggerthat without each user checking the db)....Long winded, sorry...help?
View 8 Replies View Related