Unable To Get SQLCMD Utility To Work Properly.
Nov 27, 2006
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?
--David
View 1 Replies
ADVERTISEMENT
Jun 15, 2006
Hi all,
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+'"'' '
SELECT @FullFilePath
UNION
SELECT @ExecCommand
EXEC (@ExecCommand)
SELECT @@ERROR
SELECT @Error
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage;
GOTO ErrorAbort
END CATCH
ErrorAbort:
[/code]
View 14 Replies
View Related
Sep 15, 2007
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.
View 1 Replies
View Related
Nov 6, 2007
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.
View 1 Replies
View Related
Jan 26, 2006
SQLCMD works in the Studio if SQLCMD Mode option is chosen.
OSQL and SQLCMD does not work from commandline and produces this constant burnt in message.
Sqlcmd:Error:Microsoft SQL Native Client:Login timeout expired.
Cleint and Server have the same set of protocols
Studio has been added to the list of those permitted by Firewall
Tried to connect through tcp, lpc
Remote has been enabled.
SQLNativeClient does not have a property or method by name 'timeout'.
Let me know if something else is needed?
View 3 Replies
View Related
Jul 17, 2007
Hi,
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.
Please Help!
Bhudev
View 6 Replies
View Related
Aug 15, 2006
Hello,
I'm unable to connect to Sql Server express using SQLCMD. I've trawled through countless web pages to try to solve my problem but to no avail.
Using windows 2000.
I'm getting the message:
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a coonection to SQL Server...............
Sqlcmd: Error: Microsoft SQL Native Client : Login timout expired.
I've enabled the various protocols in the Sql config manager......
Please help!
Thanks,
dom
View 7 Replies
View Related
Jan 11, 2004
Howdy,
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.
Thanks for your help.
Cheers,
SG.
View 6 Replies
View Related
Apr 3, 2008
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
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
1000082 NULL NULL Classical NULL
View 6 Replies
View Related
Mar 10, 2008
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);
}
}
View 5 Replies
View Related
Aug 29, 2007
Hi
I am writing a application using the ODBC Calls to connect to MSSQL Database 2005 SP2.
I am using the Microsoft Visual Studio 6.0 for compilation
I have defined the UNICODE macro in the project settings.
Now when i am trying to connect to MSSQL Database using this call below
retcode = SQLConnect(dbc, (SQLTCHAR*) dsn, SQL_NTS,
(SQLTCHAR*) loginname, SQL_NTS,
(SQLTCHAR*) password, SQL_NTS);
I give a wrong username .
Then i use the function
SQLGetDiagRec to collect the error
void extract_error(char *fn,SQLHANDLE handle, SQLSMALLINT type)
{
SQLINTEGER i = 0;
SQLINTEGER native;
SQLTCHAR state[ 100 ] ;
SQLTCHAR text[256];
SQLSMALLINT len;
SQLRETURN ret;
memset(state,0,sizeof(state));
memset(text,0,sizeof(text));
fprintf(stderr,
""
"The driver reported the following diagnostics whilst running "
"%s",
fn);
do
{
ret = SQLGetDiagRec(type,
handle,
++i,
state,
&native,
text,
sizeof(text),
&len );
if (SQL_SUCCEEDED(ret))
_stprintf(_T("%s:%ld:%ld:%s"), (const TCHAR *)state, i, native, text);
_stprintf(_T("Error code %s "),(const TCHAR *)state);
}
while( ret == SQL_SUCCESS );
}
Now if i check the values of "state" and "native" i get it as 0.
If i use non unicode (i.e. remove the UNICODE macro) it works fine.
Best Regards
Manoj
View 1 Replies
View Related
Jul 23, 2007
Hello,
I'm writing a program which runs SQL express installer
Code Snippet
public bool InstalSQLExpress()
{
//creating new process for setup
Process setupProcess = new Process();
//start information for setup process
ProcessStartInfo startInfo = new ProcessStartInfo();
//filename location
startInfo.FileName = sqlExpressSetupFileLocation;
//commandline arguments ("/qb" - only basic UI during the setup, "/qn" - setup with no UI)
//startInfo.Arguments = BuildCommandLine(); // <- make it work
// startInfo.Arguments = "/qb INSTANCENAME=SQLEXPRESS ADDLOCAL=All SECURITYMODE=SQL" +
// "SQLACCOUNT=konrad SQLPASSWORD=****** " +
// "AGTACCOUNT=konrad AGTPASSWORD=******" +
// "ASACCOUNT=konrad ASPASSWORD=******" +
// "SAPWD=*****";
startInfo.Arguments = BuildCommandLine();
//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
View 2 Replies
View Related
Mar 16, 2015
I am using BCP utility to export data from a view to text file. I get the following error
"Copy direction must be either r 'in', 'out' ..." when I execute the following
exec master..xp_cmdshell 'bcp [Salesforce_Prod].[dbo].[Project With Opps] out c: est99.txt -c -t, -T -S'
The same thing work if I replace the view in the statement above with a table name.
View 3 Replies
View Related
Mar 5, 2008
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
View 3 Replies
View Related
Dec 13, 2006
Greetings,
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...
Thanks,
BCB
View 3 Replies
View Related
Jul 28, 2007
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.
Thanks
Subhash Subramanyam
View 5 Replies
View Related
Mar 20, 2003
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 .
3)They suceed when run via the xp_cmdshell .
Can anybody help me out ?
Thanks,
Venkat
View 7 Replies
View Related
Mar 3, 2008
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?
Thanks
View 1 Replies
View Related
Dec 28, 2007
Hi All,
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.
Am I missing something here?
Thanks.
Venkat.
View 8 Replies
View Related
Sep 12, 2007
Hi, Pros,
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?
Thank you in advance.
View 9 Replies
View Related
Nov 7, 2007
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.
View 9 Replies
View Related
Dec 2, 2015
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?
View 2 Replies
View Related
May 4, 2007
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.
View 11 Replies
View Related
May 2, 2008
When connecting to SQL using the SQLCMD
Is there a way to do a select and it output in DOS mode...
Even have the message return - completed just as if you were in sql query.
View 1 Replies
View Related
May 22, 2008
Hello,
Does anyone know how to execute a stored procedure in a SQLCMD script? Here is what I have so far and it doesn't seem to be working...
:r $(rootPath)"Script.sql"
GO
exec sp_Proc
GO
Also,
Is there a way that I can pass the $(rootpath) as a parameter in my stored proc?
Thanks!
View 3 Replies
View Related
Feb 21, 2008
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?
Thanks for any suggestions
View 6 Replies
View Related
Aug 23, 2006
Hi,
Please can any one let me know jhow to use -y option with SQLCMD.
View 11 Replies
View Related
Jul 20, 2007
How can I use sqlcmd to execute a simple stored procedure, I dont need to pass parameters in or out, its just for backups.
Thanks
View 2 Replies
View Related
Mar 3, 2008
Greetings all!
i am using the follownig sqlcmd command to output some data :
sqlcmd -E -S myServermyInstance -s "," -W -d myDB -Q " set nocount on select ltrim('""' + cast(PersonId as varchar) +
'-' + cast(DatabaseId as varchar) + '""') as 'URN-DBID','""' + EmailAddress + '""' as EmailAddress from myDB.dbo.myTable where
DTS > dateadd(dd, -7, getdate()) set nocount off " > "\tfsvrCompanyDatabase DevelopmentTestReports"myRecords-20080303.txt
The output looks something like this :
URN-DBID,EmailAddress
--------,------------
"5-1","blahblah@HOTMAIL.COM"
"264541-1","blahblah@HOTMAIL.COM"
"1107457-1","blahblah@HOTMAIL.COM"
"6133752-1","blahblah@HOTMAIL.COM"
Is it possible to keep the headnigs but remove the dashed line?
Your help would be much appreciated.
View 5 Replies
View Related
Mar 3, 2008
Greetings all!
i am using the follownig sqlcmd command to output some data :
sqlcmd -E -S myServermyInstance -s "," -W -d myDB -Q " set nocount on select ltrim('""' + cast(PersonId as varchar) +
'-' + cast(DatabaseId as varchar) + '""') as 'URN-DBID','""' + EmailAddress + '""' as EmailAddress from myDB.dbo.myTable where
DTS > dateadd(dd, -7, getdate()) set nocount off " > "\mynetworkdrivemyCompanymyDatabase DevelopmentmyTestReports"myRecords-20080303.txt
The output looks something like this :
URN-DBID,EmailAddress
--------,------------
"5-1","blahblah@HOTMAIL.COM"
"264541-1","blahblah@HOTMAIL.COM"
"1107457-1","blahblah@HOTMAIL.COM"
"6133752-1","blahblah@HOTMAIL.COM"
Is it possible to keep the headnigs but remove the dashed line?
Your help would be much appreciated.
View 4 Replies
View Related
Mar 21, 2006
how can i change the view in sqlcmd?
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.
thanks!
View 1 Replies
View Related
Oct 8, 2006
Hi
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?
Thank you
View 7 Replies
View Related
Nov 9, 2006
I am working with SQL Express and found myself surprised when I tried to automate a backup... No Agent.
So I am trying to create a simple backup script to run from the command line and probably schedule through the scheduled task manager.
here is my problem. I get the following error :
Msg 2812, Level 16, State 62, Server FIREFLYSQLEXPRESS, Line 1
Could not find stored procedure 'B'.
Here is the batch file
sqlcmd -i c: emp estDBbackup.sql -o c: emp estoutput.txt -S FIREFLYSQLEXPRESS
And here is the sql input file :
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.
so what the heck am I missing ?
Thank you for any help...
View 4 Replies
View Related