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+'"'' '
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?
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 am getting the following error when trying to run a deployment utility. The server only has .net framework 2.0 and sql server 2005 (rtm) installed.
If it's any help, this server was recently upgraded from the june ctp to rtm.
This is a production server, so a solution involving as little disturbance to it's current state would be preferrable.
Thanks in advance for any suggestions.
-Jeremy
TITLE: Package Installation Wizard
------------------------------
Unexpected error occurred.
------------------------------
ADDITIONAL INFORMATION:
Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154. (Microsoft.SqlServer.ManagedDTS)
------------------------------
Retrieving the COM class factory for component with CLSID {E44847F1-FD8C-4251-B5DA-B04BB22E236E} failed due to the following error: 80040154. (Microsoft.SqlServer.ManagedDTS)
In reference to the question raised in this thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1460591&SiteID=1
Since I'm not able to create a deployment utility, when a config file is shared among multiple packages and also I cannot get the permission from Sys Admins to use Env. Variables I'm struck.
Now I'm thinking of importing the package to Sql Server from the file system. Is there any caveats in this approach? especially regarding the config files?
[edit] Also, do I need any special permissions to view the Integeration Services node in Management Studio? We are using Integerated Authentication, neither do I'm able to run sp_start_job sp in the msdb database. [/edit]
I would like to have my developers responsible for deploying their SSIS packages to the Test/QA environment. I tried granting access to several of the stored procedures in msdb and the sysdtspackages90 table. The only thing that seems to work is granting sysadmin priviliges. Is there a server or database role that will grant the appropriate access? thanks
We are trying to create a deployment utility for a solution. The issue we are facing is, we are using a single package configuration file and when we try to build the solution to create the deployment utility, the build process fails saying that the package configuration file already exists. THe reason for this is while trying to build, the utility copies the configation fiel for the packages, it copies for one, but for the second onward, when it tries to copies, it fails saying the file already exists.
Any idea how to overcome this, or else any suggestions how to perform the similar steps to create a deployment utility for a solution in which the packages share a single package configuration file.
When I create a deployment utility I... - set AllowConfigurationChanges to True. - set CreateDeploymentUtility to True - DeploymentOutputPath is set to binDeployment - I click 'Build' and it creates the binDeployment directory and writes all my DTSX files and my dtsConfig file But it doesn't create a manifest file. Why not? Thanks
I am getting following error when "CreateDeploymentUtility" is set to true and I try building the solution. It tries to copy a file that already exits in inDeployment folder. I am using Sept. CTP.
After moving my deployment folder to the Target Server, I run the Installation Wizard. As I move next, I am missing the window which is supposed to allow me to set package config values as stated in MSDN:
"If the package includes configurations, you can edit updatable configurations by updating values in the Value list on the Configure Packages page."
Does anyone know why I am not seeing it? In my deployment bundle which I have moved over has currently 3 files:
1) SSIS Deployment Manifest
2) SSIS Package
3) SSIS Config File
Again, I double click on SSIS Deployment Manifest, and it starts fine. I go thru the steps for File System Deployment, and then it prompts for installation folder path. After that, it takes me directly to validation. Why is it not showing me the Configure Packages Page as described in the MSDN Documentation. Please advise. Thanks.
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 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.
Dear profetionlas: I cannot run sqlcmd in my computer but i can connect to my SQL Server2005 through SSIS This is the error I see . Please give me some recommandation
C:Documents and Settings est>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.
I would like also metion that 1)windows firewall is off 2)All SQL server Services are running 3)This is my default instance also I have another named instance in the server
Just installed SQL Server 2005 Express along with the Management Studio. The Management Studio, at least what I've seen so far, seems to work fine. But when I type "sqlcmd" at the command prompt, I get "sqlcmd is not a recognized internal or external command, operable program or batch file." What gives???
GreetingsI'm trying to follow the tutorial at http://www.asp.net/Guided%2DTour/s2.aspx Part way through the demo it asks me to run the following command as part of building a Demo web page access SQL dataC:Program FilesMicrosoft SQL Server90ToolsinnSQLCMD" -S "machine-nameSqlExpress" I am then supposed to paste some script into that window, but cant get that far. The black Command window opens, but the SQL > prompt doesn't appear, and the window closes. I had previously installed a demo version of Web Developer Express from my Action Pack, on a SBS Server Premium 2003 R2, clean installation. When I got to the above step in the demo there was no ...90Toolsinn folder so, I uninstalled the Action Pack version and the versions of SQL server that looked like they did not belong to the original SBS Server installation. I then downloaded the version from Microsofts website, and selected .Net SP1 and SQL Server Express ( or lite or whatever it's called ) that were part of the install dialog box. When checking for updates, the .NET SP1 and Visual Studio SP1 initial failed. Rebooting installed .Net SP1, but I had to do a hard reboot as the installation still wasn't complete after 2 hours. I assumed it was hung. After restarting, I was able to go to MSUpdates and the installation was successful.Currently the add remove programs shows a ton of SQL stuff, ..I'm guessing we have version conflicts or something but I don't know.. Microsoft SQL Server 2005Microsoft SQL Server Desktop engine " Native Client " Setup Support files " VSS Writer Visual Studio seems to run okay, but I would like to be able to do SQL database part of the tutorial, since I don't know much about it as you can tell, and I would like to see it work with web sites. TimeTraveller
Hi ! I try to connect to a database on my localhost using sqlcmd. For the records: Remote connections are allowed ! I don't have any issues to establish a connection using SSMS.
HResult 0xFFFFFFFF, Level 16, State 1 SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. Sqlcmd: Error: Microsoft SQL Native Client : 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.. Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
The command below runs fine from within Management Studioexec sp_MSforeachtable @command1="exec sp_spaceused '?' "However, I'd like to run it via sqlcmd. I've tried variouscombinations of escaping the doulbe and single quotes but withoutsuccess.sqlcmd -E -Q "sp_MSforeachtable @command1="exec sp_spaceused '?'""Sqlcmd: 'exec sp_spaceused '?'""': Unexpected argument. Enter '-?'for help.Any ideas?Thanks,M
I'm having a problem with configure Mirroring. When I use graphical inteface to config the Mirror, it is ok. But when using sql, there are an error that I can not understand.
IF @SQLDataRoot IS NULL BEGIN RAISERROR ('Did not find the correct SQL Data Root Directory. Cannot proceed. Databases backed up but not yet restored.', 16, -1) END
DECLARE FileListCursor CURSOR FAST_FORWARD FOR SELECT LogicalName, PhysicalName FROM #BackupFileList
OPEN FileListCursor
FETCH NEXT FROM FileListCursor INTO @LogicalName, @PhysicalName
SELECT @ExecStr = N'RESTORE DATABASE $(Database2Mirror)' + N' FROM DISK = ''c:TechReady$(Database2Mirror).bak''' + N' WITH MOVE ''' + @LogicalName + N''' TO ''' + @PhysicalName + N''''
FETCH NEXT FROM FileListCursor INTO @LogicalName, @PhysicalName
WHILE @@FETCH_STATUS <> -1 BEGIN SELECT @ExecStr = @ExecStr + N', MOVE ''' + @LogicalName + ''' TO ''' + @PhysicalName + '''' FETCH NEXT FROM FileListCursor INTO @LogicalName, @PhysicalName END
-- NORECOVERY is required for Database Mirroring, replace is not. -- Replace is used here solely to allow repetitive use of this script. SELECT @ExecStr = @ExecStr + N' , NORECOVERY, REPLACE'
-- Useful for testing -- Only return the string and then comment out the EXEC line below. -- SELECT @ExecStr
EXEC (@ExecStr)
DEALLOCATE FileListCursor GO
:CONNECT $(PrincipalServer) SELECT DATABASEPROPERTYEX(N'$(Database2Mirror)', N'Status') -- Returns ONLINE SELECT db_name(sd.[database_id]) AS [Database Name], sd.mirroring_guid, sd.mirroring_state, sd.mirroring_state_desc, sd.mirroring_partner_name, sd.mirroring_witness_name, sd.mirroring_witness_state, sd.mirroring_witness_state_desc, sd.mirroring_role, sd.mirroring_role_desc, sd.mirroring_role_sequence, sd.mirroring_safety_level, sd.mirroring_safety_level_desc, sd.mirroring_safety_sequence, sd.mirroring_failover_lsn FROM sys.database_mirroring AS sd WHERE sd.[database_id] = db_id(N'$(Database2Mirror)') go
:CONNECT $(MirrorServer) SELECT DATABASEPROPERTYEX(N'$(Database2Mirror)', N'Status') -- Returns RESTORING SELECT db_name(sd.[database_id]) AS [Database Name], sd.mirroring_guid, sd.mirroring_state, sd.mirroring_state_desc, sd.mirroring_partner_name, sd.mirroring_witness_name, sd.mirroring_witness_state, sd.mirroring_witness_state_desc, sd.mirroring_role, sd.mirroring_role_desc, sd.mirroring_role_sequence, sd.mirroring_safety_level, sd.mirroring_safety_level_desc, sd.mirroring_safety_sequence, sd.mirroring_failover_lsn FROM sys.database_mirroring AS sd WHERE sd.[database_id] = db_id(N'$(Database2Mirror)') go
:CONNECT $(MirrorServer)
ALTER DATABASE $(Database2Mirror) SET PARTNER = 'TCP://DEMO:5023' -- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5091' -- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5091' GO
:CONNECT $(PrincipalServer)
ALTER DATABASE $(Database2Mirror) SET PARTNER = 'TCP://DEMO:5022' -- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5092' -- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5092' GO
ALTER DATABASE $(Database2Mirror) SET WITNESS = 'TCP://DEMO:5024' -- SET WITNESS = 'TCP://Server.fully.qualified.dns.name:5090' -- SET WITNESS = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5090' GO
SELECT db_name(sd.[database_id]) AS [Database Name], sd.mirroring_guid, sd.mirroring_state, sd.mirroring_state_desc, sd.mirroring_partner_name, sd.mirroring_witness_name, sd.mirroring_witness_state, sd.mirroring_witness_state_desc, sd.mirroring_role, sd.mirroring_role_desc, sd.mirroring_role_sequence, sd.mirroring_safety_level, sd.mirroring_safety_level_desc, sd.mirroring_safety_sequence, sd.mirroring_failover_lsn FROM sys.database_mirroring AS sd WHERE sd.[database_id] = db_id(N'$(Database2Mirror)')
and the log is:
Msg 1452, Level 16, State 6, Line 3 The partner server instance name must be distinct from the server instance that manages the database. The ALTER DATABASE SET PARTNER command failed. ** An error was encountered during execution of batch. Exiting.
I Think the error is begin at:
ALTER DATABASE $(Database2Mirror) SET PARTNER = 'TCP://DEMO:5023' -- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5091' -- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5091' GO
:CONNECT $(PrincipalServer)
ALTER DATABASE $(Database2Mirror) SET PARTNER = 'TCP://DEMO:5022' -- SET PARTNER = 'TCP://Server.fully.qualified.dns.name:5092' -- SET PARTNER = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5092' GO
ALTER DATABASE $(Database2Mirror) SET WITNESS = 'TCP://DEMO:5024' -- SET WITNESS = 'TCP://Server.fully.qualified.dns.name:5090' -- SET WITNESS = 'TCP://SQLIDW15HA.redmond.corp.microsoft.com:5090' GO
but I can not find out the solution. Turn back to grafical interface, everything is done
I can Add a connection to the database in VisualStudio 2005 in the Solution Explorer and access the database. Connection string copied from VS "Data Source=.SQLEXPRESS;AttachDbFilename=C:TempMyDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True".
If i start the command prompt and type:
sqlcmd -SlocalhostSQLEXPRESS -E -d c: empMyDB.mdf
I get the error "Login failed for user 'MyDomainPer'"
As I see it integrated authentication with the same user is used in both cases so they should give the same result. What am I doing wrong?
i am not sure if this forum is right place to ask this question.. i am trying right a dos batch file to do setup of sql commands run by sqlcmd , run some dos commands etc
net start mssql$server sqlcmd -E .....
net stop mssql$server...
sqlcmd -E ....
in unix you can run isql with the sql commands place inside..
isql -Uuser -S server <<EOF select 1 select 2 go EOF
you can put above in a shell and it will run.
i am trying to do similar stuff in windows for sqlcmd.. how can i do it
only option i have is to create lot of .sql files and run with -i option on sqlcmd..
can some body let me know how to do a inline commands in dos? thx AK
At the end of my rope here ... I was using SQL Express 2005 without trouble, until one day I couldn't access my database. I spent a day hunting down the issue without success. I uninstalled and reinstalled SQL Server many times, each time hoping it would somehow help ...
I can access SQL Server just fine through SQL Server Management Studio Express. I can get in by typing "sqlcmd -S {my machine name}SQLEXPRESS". However, I am working on a FoxPro application, and I cannot connect using FoxPro. It doesn't even seem to recognize the existence of SQL Server on the machine. Also, when I log in using sqlcmd, and type ":serverlist", I would expect my SQLEXPRESS instance to show up. It doesn't - the list of servers is empty. I suspect this is the problem, but have no idea what may be causing it.
Cumulatively, I've probably spent 3 work days trying to figure this out. Does anyone have any pointers or ideas that might help me figure out why ":serverlist" doesn't list my machineSQLEXPRESS, even though I can log in fine using Management Studio? Any help would be very much appreciated. Thank you,
I have a SQL server 2000 box. I saw a post some time ago in MSDN Forums that the sqlcmd utility could be used on SQL Server 2000 as well. However, when I tried to install sqlcmd using file SQLServer2005_SQLCMD.msi downloaded from Microsoft, I got following error:
Setup is missing prerequisites:- SQL Native Client
Does this mean that I need to install SQL 2005 Client? How do I make sqlcmd work on a SQL Server 2005 box?