.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

sqlcmd starts and then exits

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :

when I start sqlcmd I get a blank window. Then 10 seconds later, there is a brief display of text and the window shutsdown. I get this result whether I runas administrator or not.

How can I successfully start SQLCMD ?



View Complete Post

More Related Resource Links

SQLCMD: supress "Changed database context to . . ."

Product:  2008 SQL Server Standard Edition. Shell:     SQLCMD (i.e. sqlcmd -i"test.sql")Script (test.sql):   use Master;   print $(SQLCMDERRORLEVEL)The screen output is always:   Changed database context to 'Master'   0However I want the above output to be (only):   0I have tried calling SQLCMD with the -m command line parameter set to each of the {-m-1, -m 0, -m 1} settings, but none work. I have tried: set SQLCMDERRORLEVEL = each of {-1,0,1,25), but none workAnybody know the secret?Thanks in advance,Jerry

SQLCMD: Changed Database Context messages

Is there a way to suppress the "Changed Database Context to " messages in SQLCMD?  For example, I get the following: 1> use master2> goChanged database context to 'master'.1>I am trying to migrate some legacy batch files that called isql and used the output files.  These extra "Changed Database Context to " messages are causing our scripts to break, and I was hoping to avoid having to write something extra to handle these messages.Thanks.

sqlcmd, cannot connect to server

I have SQL Server installed on a machine called SQLDEV. I log on to that machine and I run the command sqlcmd -s SQLDEV -Q "select * from <db>.<schema>.<some_table> -E This command works and returns a result set.   Next, I go to a different machine. On that machine I can use SQL Mgmt Studio to log on to SQLDEV using window authentication. However, if I run the same command as above, I get some kind of a connection error. The error says, ".... 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 .....   Any suggestions/ideas why I am getting this error?

messages from sqlcmd

Would someone please explain this behavior? I'm trying to understand why the messages are coming back the way they are in the following examples. Create a simple table to which we will be inserting some values. create table test_table ( col1 int ) Next, create a sql script that inserts a bunch of integers to the above table. insert into test_table values(1) insert into test_table_ values(2) insert into test_table_ values(3) insert into test_table_ values(4) And save this file. I saved it as c:\dba\admin\test_script.sql Next, run this script from a command window using sqlcmd as follows. sqlcmd -S <your_server> -d <your_db> -i c:\dba\admin\test_script.sql   What message do you get back in the command window? I get "(1 rows affected)" for the first insert statement in the script, but nothing about the other 3 inserts. However, when I select from the table, I do see that all 4 insert statments happened. So, why am I seeing an incomplete message? Now, for the heck of it, I put a "GO" between the insert statements in test_script.sql like so. insert into test_table values(1) go insert into test_table values(2) go insert into test_table values(3) go insert into test_table values(4) Now, run the sqlcmd again like so, sqlcmd -S <your_server> -d <your_db> -i c:\dba\admin\test_script.sql What messages do you get? I get 4 lines of

VisualStateManager: change a property before it starts animation?

i realize that if we "animate" the Visibility property.. it uses the ObjectAnimationUsingKeyFrames animation to set the property after it transits to a new state... how can i change the property before it animates in the new state? i know there is the CurrentStateChanged and CurrentStateChanging event that i can use to set the property.. however... that is ok if you have 2 states.. but for my case i have a couple of states(in my case 7 states)... so if change the visibility in one of the states... the property doesn't switch back automatically when we switched to another state.... my thought of having 7 conditions to change the property just isn't the right way of doing... maybe.... it would be good if the VisualStateManager provides an attachedproperty to set on the specific ObjectAnimationUsingKeyframes to indicate whether the animation property is to be set at the start or at the end of the animation thanks

Can connect via SSMS but not SQLCMD/OSQL

I can connect to my SQL 2008 Express Edition server using SSMS.  I cannot connect using OSQL or SQLCMD and my application is having sporadic connection issues.  When I attempt to connect via OSQL, the following error is returned: Error: 18452, Severity: 14, State: 1.  Login failed.  The login is from an untrusted domain and cannot be used with windows authentication. The following are errors present in the SQL errorlog:  Error: 17806, Severity: 20, State: 2.  SSPI handshake failed with error code 0x8009030c while establishing a connection iwth integrated security; the connection has been closed. [CLIENT: <local machine>] Error: 18452, Severity: 14, State: 1.  Login failed.  The login is from an untrusted domain and cannot be used with windows authentication. I see an error in the application event log: Event 6037, LsaSrv  The program sqlservr.exe, with the assigned process ID 1788, could not authenticate locally by using the target name MSSQLSvc/{srvnm}.{workgrp}.net:{SQLinstancenm}.  The target name used is not valid.  A target anme should refer to one of the local computer names, for example, the DNS host name.  Try a different target name. Has anyone else experienced this issue - what else can I look into?      

sqlcmd - linkedserver - ALL queries fails after FIRST error from remote server - ANONYMOUS LOGON

Hello, I have very strange problem with sqlcmd , it stop working after first error returned from remote sql server (like permission denied), lets try show what I'm doing, configuration is quite simple C- client (windows 2003 x64, standalone sqlcmd client sp3) S1 - server1(windows 2003 x64, sql 2005 sp3) S2 - server2 (windows 2003 x64, sql 2005 sp3) I need connect via middle Linked Server (S1) from C to to S2, each machines have the same LOCAL Windows account C\LSUser, S1\LSUser, S2\LSUser with the same password, LSUser is not domain account, linked server is configured for Windows Account Impersonation (checked Impersonate) Example, query executed from client C: 1>exec [LS1].[DB].[dbo ].[ListTab1]; - works well, no problem 1>exec [LS1].[DB].[dbo ].[ListTab2]; - works well, no problem ok , now try modify permission on S2, I explicitly deny execute procedure [DB].[dbo ].[ListTab1] on S2 to S2\LSUser, 1>exec [LS1].[DB].[dbo ].[ListTab1]; Msg 229, Level 14, State 5, Server S2, Procedure ListTab1, Line 1 The EXECUTE permission was denied on the object 'ListTab1', database 'DB', schema 'dbo'. expected message :), but look now: 1> exec [LS1].[DB].[dbo ].[ListTab2]; Msg 18456, Level 14, State 1, Server S2, Line 1 Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. all remote queries STOP working from client C 1> select top 10 * from [L

64 bit compilation starts always with /D "Win32"

This might be a  VS general issue but I decided to post it here: I am porting a project to AMD64 bit. After solving some poting issues I am facing the following problem: The compiler is started with /D "Win32" , although in the project configuration WIN64 is defined. I tried - to rebuild... no effect - to reload solution ... no effect In the vcproj file the defines are correct. I could upload a screeenshot if possible.

How to Run a Routine When the Workflow Starts up

I have developed a workflow that is working just fine.  I am attempting to modify it so that variables are reinitialized with none-default values when the workflow is being loaded.  I created a new routine that I want to run when the workflow starts up.  This routine does the reinitializing of variables based on condidtions.  My initial intention was to place the routine within the same routine that calls InitializeComponents() (see code fragment below).  But this produces a build error.  Looks like InitializeComponents() is the only routine allowed in this procedure.  Where can I place mystartuproutine() so that it is executed when the workflow starts? Thanks for your feedback. using statement1; using statement2; using statement3; namespace MyNameSpace { public sealed partial class MyWorkflow : StateMachineWorkflowActivity { public MyWorkflow () { InitializeComponent(); mystartuproutine(); //placement here causes build error. Removal causes successful build. } routine1 { //code here } routine2 { //code here } mystartuproutine { //code here } } }

VBNET2008 SQLCMD.Parameters

Hi Good Guys, I need your help with sample coding. Please help me. I am trying to insert a new record into SQL SERVER 2000 TBLSales table using SQL Command Parameters but encounter this error message: Incorrect syntax near the Keyword 'Where' This coding that generate the above error message    strSqlInsert &= "  Where  (SalesID <> @SalesId ) " ------------------------------------------------------------------ Here is the over all Coding that I need your help. Private Sub FSaveNewData() Dim strSqlInsert As String = Nothing Try sqlconn = New SqlConnection(connstr) sqlconn.Open() strSqlInsert &= " Insert into TblSales ( SalesID, CustomerName, SaleQty, SalePrice ) " strSqlInsert &= " Values ( @SalesID, @CustName, @SalesQty, @SalesPrice ) " strSqlInsert &= " Where (SalesID <> @SalesId ) " sqlcmd = New SqlCommand(strSqlInsert, sqlconn) With sqlcmd.Parameters .AddWithValue("@SalesId", SqlDbType.Int).Value = Convert.ToInt32(intSalesId) .AddWithValue("@CustName", SqlDbType.NVarChar).Value = CType(Me.txtCustomerName.Text, String) .AddWithValue("@SalesQty", SqlDbType.Int).Value = Convert.ToInt32(Ctype(me.txtSalesQty.text, integer) .AddWithValue("@SalePrice", SqlDbType.Money).Value = Convert.ToDouble(CType(Me.txtSalesPric

How to check field is exits in XSLT?

HI,I have below XML which i am transforming into XSLT vai asp.net, How i can detect if particular name is exits in xml file?<fld id="txt1"  title="Text 1" dbfield="name1" /><fld id="txt2"  title="Text 2"  />I am trying to know how i can know if dbfield is exits or not.Below i i tried but giving error.<xsl:choose> <xsl:when test="count(@dbfield)>0"> <xsl:variable name="dbfname"> <xsl:value-of select="@dbfield"/></xsl:variable></xsl:when> <xsl:otherwise> <xsl:variable name="dbfname">0</xsl:variable> </xsl:otherwise> </xsl:choose>Thank You

workflow starts before files are saved?


I have a sharepoint designer workflow associated with a document lib. The workflow is triggered when a new item is created or modified. The workflow will update attributes of the item.

The problem comes that for small files, the workflow works. For bigger file (even 0.5 mb), either the workflow failed to update the item or the file was saved as 0 byte.

Any recommendations?

On starting SSRS Service SQLDUMper starts system freezes


HI All,

          I have SSRS 2008 64-bit for MS CRM 4. Recenlty I am facing very strange problem. If I delete ReportServer Database and then I try to access http://servername/reportserver, I get 'Cannot open database "ReportServer" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Which is obvious but if I recreate the ReportServer Database using Reporting Services Configuration Manager then instantly SQLDumper starts and URL do not show anything in browser except keep waiting. The Following Things in Dumps- (filename is SQLDmpr....log):

rpcserver!DefaultDomain!1394!09/23/2010-08:57:38:: i INFO: RPC Server started.
servicecontroller!DefaultDomain!1394!09/23/2010-08:57:38:: i INFO: RPC Server started. Endpoint name ='ReportingServices$MSRS10.MSSQLSERVER'
appdomainmanager!WindowsService_0!1394!09/23/2010-08:57:38:: i INFO: Appdomain:2 WindowsService_0 initialized.
library!WindowsService_0!120c!09/23/2010-08:57:38:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., Interval in DBPolling is too large and will make polling verification logic fail.;

Replace the string after comma starts in MS SQL


Hi All

Could you anybody help me, How to replace the remaining String after the Comma Starts Using SQL Query.  Below is the data

"MediaRights, MediaRightsLink, MediaRightsCompanies, MediaRightsTypes"

EvtBids 1
MediaRights, MediaRightsLink, MediaRightsCompanies, MediaRightsTypes 1
MediaRightsLink 8
SponsorRights, SponsorRightsLink, SponsorRightsBrands, SponsorRightsTypes 3
SponsorRights, SponsorRightsLink, SponsorRightsCompany, SponsorRightsCompanyTypes 1

SQLCMD results in a hexadecimal value for a SELECT FORXML AUTO

I have a stored procedure, that uses FORXML AUTO to reutrn an XML document.
When I call it from SQLCMD, it results in a hexadecimal value (0x....) instead of an XML text.
When I used to call it from OSQL, it resulted in a correct XML text.
When I call it from SQL Mgmt Studi or Query Analyser, the reult is also correct, an XML text.

The way I call SQLCMD is:
sqlcmd -E -S"SQLCLU01\INST01" -d"SFA" -Q"exec ReportGetDataAsXML 6760910"

The result is:

Any suggestions?

ie7 crashes when user exits from sharepoint


I have read the various issues which crash ie7 crashes with sharepoint. However, in this case, ie only crashes when the user tries to close the browser window. CPU usage then goes sometimes to 100%. The only way to use the machine is to kill the iexeplorer.exe process.

Has anybody come across this or has a solution.



Design window hangs in WPF, devenv.exe starts looping CPU around 50%


I attempt to create a new WPF project but the design window never populates and appears to hang.  CPU usage for devenv.exe starts looping around 50% usage.  I can close the project with no problems.  I disconnect the USB VGA adapter and the WPF project will load and save with no issues.  Re-connect the adapter and problem returns with any new or current project that was just working.  I've had this same problem on a different model laptop, Dell 630 I believe, as well with a physically different adapter but same model.

I've been experiencing this problem for about a year and have since gone to a different laptop and new adapter drivers and the issue persists after a fresh install of the O/S, VS2008 with SP1. Any recommendations besides not using the adapter, it's pretty integral to other job duties that I have to perform and the issue precludes me from being able to develop in the WPF environment.

Currently using a laptop DELL Latitude E6400 4 Gig memory with 2 external monitors in which one connects to the VGA port and the other connects to a USB VGA adapter (Tritton SEE2 UV100) and have installed their latest drivers.

O/S :  Windows Vista Enterprise SP2 (32-bit) 

Visual Studio 2008 SP1 

Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: Standard<

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend