It is my day for weird errors.
I use a database project and as a part of Post Deployment, we use SQL Scripts to populate data in our tables.
alter authorization on database::atlas to sa;
go
ALTER DATABASE ATLAS SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO
:r C:\Scripts\Script.DisableTriggers.sql
:r C:\Scripts\dbo\Script.dbo.PaymentMeth...
Guys,
In SSMS when I try to execute:
SELECT CONVERT(VARCHAR(MAX), REPLICATE('a',9000))
I see only the first 8000 characters displayed. The settings Tool >> Options >> Query Results >> Sql Server >> Results to Grid is set to 65534 and Results to Text is set to 8192.
Also when I try to run this from SQLCMD
sqlcmd -S Server -E -y ...
I am using the sqlcmd tool with SQL Server to execute scripts. The scripts add/update records. I need sqlcmd to stop executing and give a non 0 return value if the script throws an error. I thought the following would work but it does not.
DECLARE @intErrorCode INT
BEGIN TRAN T1;
SET IDENTITY_INSERT dbo.SomeTable ON
INSERT INT...
My company is currently using the sqlcmd 2005 for deployment and for some reason on certain SQL scripts it tends to hang even though there are no errors, and if run from management studio it completes successfully.
It tends to hang on complex scripts that have multiple GO statements and or cursors.
By "hang" I mean the process will not...
I have SQL Server 2008 installed in a Vista x64 machine.
When I look for the sqlcmd.exe, i find 2 versions, the x64 and the x86:
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe
Which one should I use ? Is there an advantage of using one over the oth...
Hello all,
I am currrently making queries to my SQL Server using SQLCMD and I run this from PHPs exec() function. I was hoping to clarify that this isn't as efficient as the driver for SQL Server for PHP: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx. I am not sure if this is the same as http://us3.php.net/manual/en/book...
I get an error when I execute the command below from a DOS window in Windows XP with SQL Server 2008. -S is the option to specify the server name.
error: Sqlcmd: '-S': unknown option.
sqlcmd –S localhost –d databasename -i C:\files\somefile.sql –E
...
We sometimes write dataport scripts that rename tables or columns and have other complex logic. We also have SQL in IF statements referencing those old columns or tables. We have a standard to use IF statements to make our SQL Scripts multi run friendly.
However occasionally, even though the if statement evaluates to false, the code w...
I have a nant script that ...
1. takes the content of disc-file
2. assigns that content to a nant property
3. and then calls sqlcmd with a -v passing in that property containg the content of the disc file
4. inside the sql script the contents of the file should be used by a stored proc.
The problem is that when the content of the file ...
Is it possible to use the sqlcmd command to dump table structure the way it can be done with mysqldump?
...
Hello all,
I have a PHP script that queries SQL server using SQLCMD - I am using SQL Server Express 2008.
Most of my queries go through to SQL Server fine but sometimes I get this:
sqlcmd return output is: Array
(
[0] => Msg 4060, Level 11, State 1, Server ABS-PC\SQLEXPRESS, Line 1
[1] => Cannot open database "test_v02" reques...
Hello all,
I run queries using SQLCMD utility via PHP and I wanted to know if there was a way to stop queries or scripts that I have executed via another SQL command by passing the process ID or something.
I also make use of the PHP Driver for SQL Server would it be easier to do this way?
Or is none of this possible - once a query run...
Is there any possibility to encrypt all existing stored procedures of a SQL Server 2008 database AFTER they have been created via an SQLCMD script?
The reason I want to do this is the following:
I'd like to develop the stored procedures without encryption so I can easily click on "Modify" in SQL Server Management Studio to check their c...
Does a command line tool ship with Informix 11.5 similar to SQLCMD for SQL Server?
If yes, how do I connect to a remote server and perform regular SELECT/INSERT/UPDATE queries using it?
...
How to run SQLCMD with builtin Administrator Group.
...
Hey all,
So we have a .bat file that runs SQL scripts, e.g.
@ECHO --- 03_Case6395_Publication.sql --- >> dbupt.log
sqlcmd -U %1 -P %2 -S %3 -d %4 -i 03_Case6395_Publication.sql -k -b >> dbupt.log
IF ERRORLEVEL 1 GOTO ErrorTag
The script runs and gives no errors, but the script doesn't actually affect the database. In the example abo...
I'm just starting out with sqlcmd on SQL Server 2005, enterprise edition.
I can connect to my server fine, from the command line:
sqlcmd -SSQLSERVERNAME -Q"select test=1"
However, when I create a junk.sql file that has just this one line:
:connect -SSQLSERVERNAME
...and try to run it by running the following at the command line:
...
Is there a way to suppress "x rows affected" in SQLCMD from the command line?
I'm running an MSBuild script and don't want it clogging up my log on my build server.
I'd rather not have to add "SET NOCOUNT ON" in every script, so if there's a way to do it from the command line, that would be fantastic.
...
I have foo.sql as:
print 'foo=$(foo)'
Then I have in foo.cmd the following shell script:
sqlcmd -i foo.sql -v foo="c:\path"
Running foo.cmd prints:
foo=\path
how do I escape the "c:"? Is dos-shell eating it, or is it sqlcmd?
...
Hello,
I am trying to execute a batch file from C# code using Process class. Batch gets to parameters, passed as quoted strings into ProcessStartInfo.Arguments. Everything is working great, besides the fact that when batch is executed its pre-pended with a few garbage ascii symbols I cannot figure out where they coming from.
Batch script...