I try to go to a command prompt to get this to run right with no luck. Is there something that I am not doing right? It gives me the help library, but thats about it. Also, I have dealt with Oracle in the past. And was wondering is there a way to access the SQLCMD utility on a workstation with a login of some kind?
I'm looking at creating a sample utility script that will invoking scripts to deploy some SQL code. For example, a utlity script that will run a SQL script, and on successful completion, execute the next script.
Having not used SQLCMD at all before, and being very new to SQL2005 (< 1 month) please guide me if there is a better way of invoking this... For example, a way of avoiding the xp_cmdshell invocation!
The following code invokes a script, but I'm trying to find a way of getting a return code back from sqlcmd, so I can progress and do the next, or fail if the return code <> 0 (success).
[code]
--Process to create DB, Tables, and Stored Procedures
set nocount on
DECLARE
@Error int,
@ExecCommand varchar(512),
@FullFilePath varchar(255)
--create the database
BEGIN TRY
SET @FullFilePath = 'D:DocumentationProjectsIntegration ServicesBIDS ProjectsTesco DNF Integration ServicesTescoDNF ProductPromoSQL CodeOBJECTSCreate DB TescoDNF_SSISPackageManager.sql'
SET @ExecCommand = 'xp_cmdshell ''sqlcmd -S RgalbraithSQL2005_1 -i "'+@FullFilePath+'"'' '
The MSDN Library topic Using the sqlcmd utility(SQL Server Express) states "To access the sqlcmd utility, click Start, click Run, and type sqlcmd.exe."
A command prompt window opens with "SQLCMD" in the title bar. I cannot enter anything in the command prompt window and the window remains open for only about five or six seconds.
The version I have installed is MS SQL Server 2005 Express with SP2. The cumulative updates package 3 does not list this problem, so I did not install it.
Neither the SQLCMD utility nor SQL Management Studio Express will function any longer but the DB engine still works when connecting via VB Express or EXCEL VBA. SQLCMD tries to connect to the internet then stops with no message. Problems started with SQL Management Studio Express whereby the screen dialog seems corrupted when I start to use New Query or try to copy and paste queries so I uninstalled and reinstalled SQL Express and seem to have made the problem worse. My system has Office 2003 with Business Contact Manager (ie MSSQL$MICROSOFTSMLBIZ) which seemed to cause a problem with the SQL Express install so I uninstalled Business Contact Manager but still no success. Anything special I need to do in the uninstall/reinstall that I might not be doing ? Thanks.
I've my SSIS Packages, having multiple Configuration stored in SQL Server Table named [SSIS Configurations].
And it's devloped on BHUDEV Server ON Devlopmentdb Database. So durring development Default Cofigurations are set for BHUDEV Server.
Problem is that when I install my Package on SQL Server on different Server for example JOHN, and now my database is ProductionDB and [SSIS Configurations] table will be on ProductionDB database. And I've made required changes in [SSIS Configurations] table. So when I run the Package even then it picks configuration information from BHUDEV.Developmentdb.dbo.[SSIS Configurations] table. That's my problem.
But If when during execution time, I change the connection information then it works fine.
Is SQL 2000 clustering on windows 2000 any good ??
We are looking at spending *quite* a bit of money to implement it, but I need opinions of what its like from the people that actually use it & look after it.
e.g.
DOES IT WORK LIKE IT SHOULD???????? Is it reliable? Is it resource hungry? Are there lots of bugs?
All repsonses very welcome. No response too small.
hi guyz i am trying to trap the duplicate records . cannot trap the below dupes any idea. i also used ltrim and rtrim it still thinking it is a duplicate but it is not. what is the best way doing it.
select count(*) , muzenbr from muzealbums_1 where muzenbr = '1000082' group by MuzeNbr, PNOTES, CNOTES, CAT3, Performer having count(*) > 1
MuzeNbr nvarchar no 14 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS PNOTES nvarchar no -1 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS CNOTES nvarchar no -1 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS CAT3 nvarchar no -1 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS Performer nvarchar no 510 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS
Does sseutil work properly on vista? I need a way to programmatically detach a user instance on Vista. The following launches and runs ok on XP. Doesn't run on Vista? Is there some problem with Process on Vista? sseutil runs ok from the command line in Vista.
public void DetachDatabase(string filePath) { ProcessStartInfo startInfo = new ProcessStartInfo("SSEUtil.exe"); startInfo.WindowStyle = ProcessWindowStyle.Normal; //.Hidden; startInfo.Arguments = "-d "" + filePath + """; Process detachProcess = Process.Start(startInfo); while(!detachProcess.HasExited) { Thread.Sleep(1000); }
//we're not using system shell to process execution
startInfo.UseShellExecute = false;
//adding start info
setupProcess.StartInfo = startInfo;
setupProcess.EnableRaisingEvents = true;
setupProcess.OutputDataReceived += new DataReceivedEventHandler(setupProcess_OutputDataReceived);
setupProcess.ErrorDataReceived += new DataReceivedEventHandler(setupProcess_ErrorDataReceived);
setupProcess.Exited += new EventHandler(setupProcess_Exited);
//running the process
return (setupProcess.Start());
}
private string BuildCommandLine()
{
string strCommandLine = null;
MessageBox.Show("SQL");
if (this.sqlSecurityMode)
{
strCommandLine = "/qb";
strCommandLine += " INSTANCENAME=SQLEXPRESS";
strCommandLine += " ADDLOCAL=All";
strCommandLine += " SECURITYMODE=SQL";
strCommandLine += " SQLACCOUNT=" + sqlAccount;
strCommandLine += " SQLPASSWORD=" + sqlPassword;
strCommandLine += " AGTACCOUNT=" + sqlAccount;
strCommandLine += " AGTPASSWORD=" + sqlPassword;
strCommandLine += " ASACCOUNT=" + sqlAccount;
strCommandLine += " ASPASSWORD=" + sqlPassword;
strCommandLine += " SAPWD=" + SysadminPassword;
return strCommandLine;
}
else
{
return strCommandLine;
}
}
When I specify command with literal value it works fine but when I try to use function or variable installer prompt error message:
SQL Server Setup could not validate the service accounts. Either the service accounts have not been provided for all of the services being installed, or the specified username or password is incorrect. For each service, specify a valid username, password, and domain, or specify a built-in system account.
I don't know why it's wrong and be gracefull for help
Hello all,The followinq qurey returns sometimes values of null to some of this columns, byK,byT,byD. the column F wil not contains any nulls, and 0 will be populated in it at any case of .Now, the problem is that when sorting out F the sort will not work when there is null parameters in byK because teh fact that a 0 values is greater then NULL value, and the sort of F will not take in considiration. So I guess the question is how can I sort NULL values and 0 values to be the same weight in the sort by command? SELECT A.gym_id as gym,s_id, week, gym_name, boxer, league, sum(points) points,sum(byK)as byK, sum(byT) as byT,sum(byPoints) as byPoints , sum(byD) as byD, count(C.gym) as F FROM A inner JOIN B ON A.gym_id = B.gym_id left JOIN C ON A.gym_id = C.gym WHERE (B.l_id = ?text group by A.gym_id order by points DESC,byK DESC,byT DESC, byPoints DESC, byD DESC,F ASC
I have an expression in a precedence constraint that is returning false when it should return true. This is the expression that returns false:
((5500 / 9990) * 100) > 10
The following expression returns true. I did the division (5500 / 9990) myself and substituted the resulting value:
((0.55055055055055055055055055055055) * 100) > 10
Why is the first expression returning false? I'm stuck in the mud up to my axles on this and I know I'll probably feel like a fool when I learn the answer...
Hi Friends "I wonder why the boolean values Set to "Disable Property" using expressions does not work as expected (though Precedence constraints work fine). I find no way to disable individual task. "
I have a boolen variable V, (False) enabled by default at design time for a task T, I disable T based on a condition (if A ! = 'a') during runtime.
Now first time when I run the Package, Task gets disabled (works fine on the condition given). However T gets permanently disabled even after we stop debug mode, which is not the expected behavior. Further on when you run, it wont work at all.
Is it true that a task disabled at design time cannot be enabled during runtime via expressions ?
If things are working fine in your case, pls let me know what settings are required.
I am unable to execute DTS packages,ISQLs when scheduled from SQL Server Agent . It dispalys a Dr.Watson Access Voilation message on the box .The result of the job is "failed as the step did not return any result ".
1)The utilities run fine when run from clients from other computers .
2)They fail again when run thru the command prompt of the box .
Hello, I tried to use bookmarks in OLEDB consumer templates and I have problems with using MoveToBookmark. This method sets cursor position correctly on bookmarked row, but it seems to me it doesn't set the right cursor position in DB. When I call MovePrev after MoveToBookmark, I will not get previous row of the bookmarked row. Simplified Example - I get bookmark of the first row, then move to the 3th row. Call MoveToBookmark (current row is no the first row). But when I call MovePrev I'will not get DB_S_ENDOFROWSET but the second row:
MoveFirst() bk = GetBookmark() MoveNext() MoveNext() // Now I'm on third row MoveToBookmark(bk) GetData() - Now I get data from 1st row MovePrev() GetData() - Now I get data from the second row!!
All calls to OLEDB returs S_OK. Does somebody now, whats wrong?
I have created a solution which contains only 2 packages say Package1.dtsx and Pakage2.dtsx. I want to create a deployment utility to deploy onto other developers machince. I changed the project properties "CreateDeploymentUtility" to TRUE. When I do the build it is not creating the files in "Deployment" folder. It is saying Rebuild All Failed but the error is not showing.
For more information the 2 packages have 4 indirect configurations from environment variables which are storing the actual config file path.
I am new to SQL server 2005. We have installed SQL server 2005 cluster. I tried to setup peer-to-peer replication with another standard server. Unfortunately, when I creating publication, I got error message : SQL server cound not configure "MyServer" as a Distributor [New publication Wizard] Additional information: An exception occurred whild executing a Transact_SQL statement or batch. The Server "Myserveris already defined as a Distributor. To reconfigure the server as a Distributor, you must first uninstall the exisitingDistributor. Use the stored procedure sp_dropdistributor, or use the Disable Publishing and Distribution Wizard. Changed database context to 'master'. [Microsoft SQL Server, Error: 14099]
I tried to use sqlcmd and I got another error message: C:>sqlcmd HResult 0x2, Level 16, State 1 Named Pipes Provider: Could not open a connection to SQL Server [2]. Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi shing a connection to the server. When connecting to SQL Server 2005, this failu re may be caused by the fact that under the default settings SQL Server does not allow remote connections.. Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
Does anyone have any idea how to get the sqlcmd work?
Good Morning, I've been searching through all the tutorials and questions, have tried many things. I am still getting "[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]"
as an error. This is what I've got:
I€™m using SQL Server Express 2005, installed with the default settings. Had not touched this program for anything until I started to follow directions to fix Error 26. Visual Web Developer Express ASP.NET is what I€™ve used to build the webpage. I was using the ASP.NET web configuration to add users to the database, which is set to use the provider ASPSqlServerProvider. SQL Server 2005 Surface Area Configuration Database Engine Remote Connections €“ set to €śLocal and Remote Connections €“ Using TCP/IP Only€? SQL Server Browser is Enabled and Running - is set to Active, under Built In Account €“ Network Service I have created Windows firewall exceptions for: sqlservr.exe sqlbrowser.exe udp port 1434 SQL Server Configuration Manager both SQL Server and SQL Server Browser are running. Under SQL Server 2005 Network Configuration Shared Memory and TCP/IP are enabled only.
SQL Native Client Configuration Shared Memory 1 TCP/IP 2 Named Pipes 3 all enabled
I read through the post at http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx but as I'm new to SqlServer I do not know how to check on the first three items.
I'm getting extremely frustrated, and would just like the login portion of this website to start working before my boot ends up through the computer. Please help, lol, thank you.
I'm trying to get the application logging to work, but nothing is happening. I'm using SQLServer2014.
I've followed the instructions on [URL] .... , even copying and pasting the snippet into web.config, but nothing happens, no log is created in the default directory.
Is there something version specific? Does 2014 behave differently?
I cannot get SQLCMD to run. When I run it, it appears for a few seconds then dissappears. I tried running it in cmd and it says it cannot run because the default setting for SQL server does not allow remote connections. Please help.
I am trying to backup/restore a sql db using sqlcmd. My question is, the box that I am trying to run sqlcmd on does not have SQL server 2005 installed, can I just copy SQLCMD.exe to the box instead of Installing it? if so, are there any other files that I need to copy as well?
I have another instance where I was trying to backup/restore a 2000 sql db and all I did was copy the osql.exe and resource files to the box and was able to run this command with out installing SQL server 2000. So, did something change with SQL serve 2005?
such as changing the font or the window size so that a command such as sp_tables will list on one row rather than several. Also I would only like to see 10 records or so at the same time. Currently in default setting, if i run sp_tables I can really only view the last few records.
I found it a bit annoying to type Go after some very simple query and I wonder is there a short cut to execute the query i type right after I press enter?
1> select * from Table 2> go <enter>
instead, how to you execute line 1 without entering go?
BACKUP DATABASE [DNNDEV] TO DISK = 'C: emp estdnndev.bak' WITH NOFORMAT, NOINIT, NAME = 'dnndev-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10;
If I put a USE statement in front of my backup statement - the error message changes to
Could not find stored procedure 'U'.
So it would appear to list the first character encountered.
As a sanity check I created a similar process which does a select * from a table and I do not get an error saying :Could not find stored procedure 'S'. - instead all is well and I get my output and no error
If I try the backup command in SQLCMD interactively it works.