Profiler Does Not Comment Out Security Related Commands When There Is An Error In The Batch
Aug 1, 2006
i am testing some encryption
scenarios ,in profiler the statements like "OPEN KEY" and all "Encrypt"
and "Decrypt" functions are removed automaticly from the trace
and replaced with a comment ,create a trace and try the code i attached ,
you will see in profiler trace that that all encryption related commands
are commented out ,this is what expected.
but now go to the batch and comment out the "SELECT @rrr' statment,
and run the batch ,this batch will fail beacuse "@rrr" is not declared,
now go back to profiler and you will see that for the failed batch
all the encryption command are NOT COMMENTED OUT !!!
esspecially important is the visibility of the password of the open key command.
seems like a very dangerous bug to me!!!
CREATE CERTIFICATE test1
ENCRYPTION BY PASSWORD = 'pGFD4bb925DGvbd2439587y'
WITH SUBJECT = 'Sammamish Shipping Records',
EXPIRY_DATE = '10/31/2009';
GO
CREATE SYMMETRIC KEY Key09 WITH ALGORITHM = TRIPLE_DES
ENCRYPTION BY CERTIFICATE test1;
GO
declare @Str nvarchar(100)
declare @Enc varbinary(max)
set @Str = 'encrypt this'
OPEN SYMMETRIC KEY Key09
decryption by CERTIFICATE test1 WITH PASSWORD = 'pGFD4bb925DGvbd2439587y'
SET @Enc
= EncryptByKey(Key_GUID('Key09'), @Str);
---select @rrr
select CONVERT(nvarchar(100), DecryptByKey(@Enc))
go
View 1 Replies
ADVERTISEMENT
Sep 13, 2006
Hello
I have a script ,which runs with osql
The script is :
osql -E
declare @cmd nvarchar(1000)
declare @cmd2 nvarchar(1000)
declare @state1 varchar(100)
declare @message varchar(100)
set @message = ''
-- Build command to determine state of SQLSERVERAGENT service on Master Server
SET @CMD = 'create table #state (state varchar(2000))' + char(10) +
'declare @cmdx varchar(1000)' + char(10) +
'insert into #state EXEC master..xp_servicecontrol ''''QueryState'''', ''''SQLSERVERAGENT''''' +
+ char(10) + 'select @state=state from #state' + char(10) +
'drop table #state'
-- Build command to execute command that determines state of service being monitored
set @cmd2 = 'declare @state varchar(100)' + char(10) +
'exec ' + rtrim(@@servername) + '.master.dbo.sp_executesql N''' + @CMD + ''',' +
'N''@state varchar(100) out'',' +
'@state out' + char(10) +
'set @state1 = @state'
-- Execute command and return state of service being monitored
exec master.dbo.sp_executesql @cmd2,N'@state1 varchar(100) out',@state1 out
-- Is the service that was monitored not
IF (UPPER(@state1) <> 'RUNNING.')
--if @state1 <1 'Running.'
begin
-- Display message that primary monitor is down
select @message = @message+char(13)+ @@servername + ' -' + 'Sql Server Agent Not Running'+char(13)
print 'Master server "' + rtrim(@@servername) + '" for monitoring is not available.'
exec master.dbo.xp_smtp_sendmail
It works fine when I run it on the command line prompt.
And I receive a mail , if the server agent is running.
But when I save it as bat file and try to run , it stops and doesnot even give an error.
Can anyone let me know what I can do.
Thanks
View 1 Replies
View Related
Aug 11, 2005
We had been running SQL Server without any control of security (sincethe company is very small -100 employees). All of us know the adminpassword and has been accessing the database as admin. Our databaseserver crashed due to hardware failure twice last month and we lost alot of important data. Now the management is taking the control ofserver access seriously.SQL Enterprise manager is installed on many PCs and any one can deleteany database with a right click.My question is:1. Can the enterprise manager be installed on client's PC with alimited right (or as a user not as admin)?We need to limit the user's access of using the Enterprise Manager.In other words, how can we set this up for different users.2. How can we keep running SQL Server if one server fails?Clustering or Replication or Mirroring? OI would highly appreciate if you could direct me to any website orresources on how to set up security of SQL Server (2000 with the latestservice pack).Thanks a million in advance.Best regards,Mamun
View 2 Replies
View Related
Jun 25, 2007
With SQL Server 2005 there is an option to grant a person access to Profiler for tracing SQL. This is done with the "GRANT ALTER TRACE" statement. The statement has to be executed at server level i.e. the master database.
The user in question only has access to certain databases on that server. The security problem that arises is that with the Profiler rights active, he can see the sql commands that are executed on the databases he has no rights for. Those SQL commands are executed by others users.
How do I configure security rules so that the person in question can use Profiler, but can only see the SQL statements that are executed on the databases he has the rights for? TIA!
View 1 Replies
View Related
Sep 11, 2007
I am running SQL Server 2005 SP2 and I am getting an SQL error due to the server not recognizing the "--" as a comment. (I am using the 32-bit version) The same code runs on SQL Server 2000 with no problem.
Is there a setting to correct this? Do I need to install the cumulative update pkg 3 to correct this problem?
View 9 Replies
View Related
Jul 23, 2005
On the other database types, there is an audit capability in that yourecord such items asfailed login attemptsattemtped access to tables user is not authroized tochanges to databse schemachanges to permissionschanges to logins (add, delete, lock, unlock, passwrod reset)All I can find in the SQLServer documentation is the reference totracking failed logins when you set up a database, plus the Profiler'sactivities.Yes, I'm taking voer my first SQLServer database and have been asked tomake sure that this database is closely monitored for inappripriateactivity.Questions:1) Does SQLServer have this capability? (Sybase has this, which iswhere I'm coming from)2) Does SQLServer do this automatically or do I have to set up theevents to be tracked as happens with Sybase?3) What commands are there for setting up these events to be tracked?Thanks in advance!
View 2 Replies
View Related
Jun 23, 2006
Hi,Is there anyone encountered this error before & how it is being resolved?[Microsoft][ODBC SQL Server Driver][SQL Server]Missing end comment mark '*/'The error pops-up when I was running a DTS Import/Export from a SQL server(source) to another SQL server (destination) residing on a differentmachine. I'm copying all tables, views, & stored procedures of a database.Thanks for any input.Regards,Maricel
View 1 Replies
View Related
Oct 26, 2007
CLIENT SIDE:
If the query is reading from large table, (100 columns x 20000 rows)
I have no problem getting results using SQL Query Analyzer on the Client side.
However, I am getting timeout problem from the client side application.
The query failed. The message from the database engine was:
Microsoft OLE DB Provider for SQL Server: Timeout expired.
SERVER SIDE:
I tested the same query on the server using the application. I can get the results.
ENVIRONMENT:
Server machine:
The Server : Windows 2003 Server SP2
Database Server : SQL Server 2000 €“ (8.00.2039 Standard Edition SP 2)
linkserver (OLE DB 9.0.0.3504 ) to FoxPro 9.0 SP1 table
SQL Server Timeout Settings: Query time-out (sec, 0=unlimited)
Client machine:
Windows XP SP2 : Windows Network Authentication
SQL Server 2000 client
For some reason my environment doesn€™t like the outside application to connect to the server long time?
Do you have any idea how to fix this timeout problem? Do I need to configure DCOM or DTC?
View 1 Replies
View Related
Feb 24, 2003
I would like to eliminate all hardcoded login ids and passwords and would like to know what other companies are doing to address this issue. I know a job scheduling software package is the ideal solution, but until dollars become available I need a short-term solution. We've tossed around the idea of using system variables.
Any recommendations?
Thanks, Dave
View 3 Replies
View Related
Oct 20, 2015
Is it possible for a batch command to give access or add a new role for the user to database? Basically:
USE my_Database
CREATE USER [User1] FOR LOGIN [User1] WITH DEFAULT_SCHEMA=
[dbo];
EXEC sp_addrolemember 'Application1', 'User1'
EXEC sp_addrolemember 'SQL_Read_Only', 'User1'
If User1 was already created then ignore that and run the exec sp_addrolemember. Next,Â
EXEC sys.sp_change_users_login
@Action = 'Update_One',
@UserNamePattern = 'User1',
@LoginName = 'User1',
@Password = NULL
to link the orphan user within database.
View 3 Replies
View Related
Oct 1, 2004
I'm building a simple webform, except Visual Studio and my service provider have combined to drive me nutty.
First, I MUST use an ODBC connection to my remote SQL Server do to some unknown configuartion problem. I've been playing with Visual Studio for only a month, so normally when something goes wrong I can go look in the mirror and find the culprit. This is different. I've got a totally functional web form with a SQL Connection, but when I try to change it to an ODBC Connection, I get the following error.
An OdbcParameter with ParameterName '@CertHolder' is not contained by this OdbcParameterCollection
My coding is fine because I stole it straight from the walkthrough and it works. But the specifications that Visual Studio provide are quite suspect. Please note the failure to include some key "@" signs.
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.cmdUpdate = New System.Data.SqlClient.SqlCommand
Me.cmdGetAll = New System.Data.SqlClient.SqlCommand
Me.cmdSelect = New System.Data.SqlClient.SqlCommand
Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
Me.OdbcGetAll = New System.Data.Odbc.OdbcCommand
Me.OdbcSelect = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdate = New System.Data.Odbc.OdbcCommand
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "this works fine"
'
'cmdUpdate
'
Me.cmdUpdate.CommandText = "UPDATE InsuranceData SET Name = @Name, Address = @Address, Address2 = @Address2, " & _
"City = @City, State = @State, Zip = @Zip, CertHolder = WHERE (CertHolder = @Cert" & _
"Holder)"
Me.cmdUpdate.Connection = Me.SqlConnection1
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Name", System.Data.SqlDbType.NVarChar, 50, "Name"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address", System.Data.SqlDbType.NVarChar, 50, "Address"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address2", System.Data.SqlDbType.NVarChar, 50, "Address2"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@City", System.Data.SqlDbType.NVarChar, 50, "City"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@State", System.Data.SqlDbType.NVarChar, 50, "State"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Zip", System.Data.SqlDbType.NVarChar, 50, "Zip"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CertHolder", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CertHolder", System.Data.DataRowVersion.Original, Nothing))
'
'cmdGetAll
'
Me.cmdGetAll.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData"
Me.cmdGetAll.Connection = Me.SqlConnection1
'
'cmdSelect
'
Me.cmdSelect.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData W" & _
"HERE (CertHolder = @CertHolder)"
Me.cmdSelect.Connection = Me.SqlConnection1
Me.cmdSelect.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CertHolder", System.Data.SqlDbType.NVarChar, 50, "CertHolder"))
'
'OdbcConnection1
'
Me.OdbcConnection1.ConnectionString = "This works fine"
'
'OdbcGetAll
'
Me.OdbcGetAll.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData"
Me.OdbcGetAll.Connection = Me.OdbcConnection1
'
'OdbcSelect
'
Me.OdbcSelect.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData W" & _
"HERE CertHolder = @CertHolder"
Me.OdbcSelect.Connection = Me.OdbcConnection1
Me.OdbcSelect.Parameters.Add(New System.Data.Odbc.OdbcParameter("CertHolder", System.Data.Odbc.OdbcType.NVarChar, 50, "CertHolder"))
'
'OdbcUpdate
'
Me.OdbcUpdate.CommandText = "UPDATE InsuranceData SET Name = @Name, Address = @Address, Address2 = @Address2, " & _
"City = @City, State = @State, Zip = @Zip WHERE CertHolder = @CertHolder"
Me.OdbcUpdate.Connection = Me.OdbcConnection1
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Name", System.Data.Odbc.OdbcType.NVarChar, 50, "Name"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Address", System.Data.Odbc.OdbcType.NVarChar, 50, "Address"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Address2", System.Data.Odbc.OdbcType.NVarChar, 50, "Address2"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("City", System.Data.Odbc.OdbcType.NVarChar, 50, "City"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("State", System.Data.Odbc.OdbcType.NVarChar, 50, "State"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Zip", System.Data.Odbc.OdbcType.NVarChar, 50, "Zip"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Original_CertHolder", System.Data.Odbc.OdbcType.NVarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CertHolder", System.Data.DataRowVersion.Original, Nothing))
I NEVER EVER TYPED ORIGINAL_CERTHOLDER IN THE SQL PREPARATION
End Sub
Protected WithEvents btnSave As System.Web.UI.WebControls.Button
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents ddlCertHolder As System.Web.UI.WebControls.DropDownList
Protected WithEvents txtName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAddress As System.Web.UI.WebControls.TextBox
Protected WithEvents ddlCH As System.Web.UI.WebControls.DropDownList
Protected WithEvents cmdUpdate As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdGetAll As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdSelect As System.Data.SqlClient.SqlCommand
Protected WithEvents txtAddress2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtState As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
Protected WithEvents OdbcGetAll As System.Data.Odbc.OdbcCommand
Protected WithEvents OdbcSelect As System.Data.Odbc.OdbcCommand
Protected WithEvents OdbcUpdate As System.Data.Odbc.OdbcCommand
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Comments? Suggestions, I am not positive about how to fix this.
View 2 Replies
View Related
Sep 24, 2015
Got this error running a query with ssms2014
on SqlServer2014
but db has Compatibiliy level 100 (sql2008)
no sql error code in message and no error found in eventviewr (sqlserver log, windows log, application log ecc)when i run that query i got this message in "messages" tab, and in results tab i got a strange result, indeed the value returned doesn't exists in table.
ex table1.field1 possible values= 2,3
it returns 1113344
we got that error thru jdbc too...that query use a lot of joins, unfortunatley i can't post it here. today got this error, so i make a copy of 1 of involved table into another db in the same instance, re run the query on the original db, and it works well.
View 2 Replies
View Related
Sep 9, 1999
I get the following error when I try to run Profiler from my client to any of our SQL Servers:
[Microsoft][ODBC SQL Server driver][SQL Server] The operation could not
be completed because your security context could not be impersonated.
Use the SQL Server client configuation application to ensure that you are
connecting using either the Named Pipes or Multiprotocol network library.
We'd like to be able to use TCP/IP for this but I've tried it with Multiprotocol also and still get the same error message.
I would appreciate any suggestions for resolving this.
Thanks.
Jane
View 2 Replies
View Related
Apr 26, 2006
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
This is the error i get every now and then when i attempt to browse to a page. It seems that i am getting this error as its trying to connection to a sql express database??? Only i have set my project up to use sql server 2000 and i am using that DB but every now and then i get this error. Im not sure what else i need to do? Any ideas?
View 4 Replies
View Related
Feb 28, 2008
I am getting this error
An error occurred while executing batch. Error message is: The directory name is invalid."
in sql management studio.
i found that if i switch to results to text i don't get the error but with results to grid I get it no matter what i query in any database on the server.
View 2 Replies
View Related
May 14, 2007
I SQL Server 2005 Profiler when ran the T- SQL template against some Stored Procedures, in the error column i get 2 - Abort. Can some one help me on this issue.
Thanks
View 1 Replies
View Related
Jul 27, 2006
I run Profiler against my production Db to keep an eye on poorly performing t-SQL batches and SPs. There's an "Error" column in the profiler output. According to BOL (topic:Describing Events by Using Data Columns), Error = The error number of a given event. Often this is the error number stored in sysmessages.
The profiler output usually shows "0 - OK" in the error column. But it sometimes shows "1 - Error" or "2 - Abort" in this column. What do these error messages mean? I've looked around but haven't been able to find anything more detailed about what these two messages mean and how I can perhaps dig deeper to figure out what's going on. (When these values are displayed, CPU is usually taking a beating and the SPID runs this for at least 30 seconds before displaying information pertaining to this SPID).
Thanks much,
Smitha
View 9 Replies
View Related
May 21, 2008
Hi y'all I have a problem in my query.This is my querySELECT dbo.BOS_GL_Workplace.WpszState, Emp2.szName, Emp1.szName AS szEmpName, Emp1.szEmployeeId, dbo.BOS_PI_Division.szName AS Divisi, dbo.BOS_PI_Team.szDescription,dbo.BOS_SD_Route.szRouteId, dbo.BOS_SD_Route.szDescription, dbo.BOS_SD_Route.szScheduleId, dbo.BOS_SD_RouteItem.szCustId, dbo.BOS_SD_Route.szOpUserId,dbo.BOS_AR_Customer.szCustId ,dbo.BOS_AR_Customer.szName, dbo.BOS_AR_Customer.CustszAddress_1 AS AlamatKirim, dbo.BOS_AR_Customer.szTaxId, dbo.BOS_AR_Customer.CustszAddress_1 AS AlamatTagih, dbo.BOS_AR_Customer.CustszCity, dbo.BOS_AR_Customer.CustszZipCode, dbo.BOS_AR_Customer.szStatus, dbo.BOS_AR_CustSales.szPaymentTermId, dbo.BOS_AR_CustSales.decCreditLimit,BOS_AR_Customer.dtmStart,BOS_AR_Customer.dtmLastUpdated FROM dbo.BOS_PI_Employee Emp1 LEFT OUTER JOIN BOS_PI_Employee Emp2 on Emp1.szSupervisorID = Emp2.szEmployeeID Left outer join dbo.BOS_GL_Workplace ON Emp1.szWorkplaceId = dbo.BOS_GL_Workplace.szWorkplaceId LEFT OUTER JOIN dbo.BOS_PI_Division ON Emp1.szDivisionId = dbo.BOS_PI_Division.szDivisionId LEFT OUTER JOIN dbo.BOS_PI_Team ON Emp1.szTeamId = dbo.BOS_PI_Team.szTeamId LEFT OUTER JOIN BOS_SD_Route on Emp1.szEmployeeId = BOS_SD_route.szOPuserId LEFT OUTER JOIN BOS_SD_RouteItem on BOS_SD_Route.szRouteId = BOS_SD_RouteItem.szRouteID LEFT OUTER JOIN BOS_AR_Customer on BOS_SD_RouteItem.szCustID = BOS_AR_Customer.szCUstID LEFT OUTER JOIN BOS_AR_CustSales on BOS_AR_Customer .szCustId = BOS_AR_CustSales.szCustID When I run that query, it was working fine the result was correct. Then I tried to add the where clause, like this:WHERE BOS_AR_Customer.dtmLastUpdated >= '8/1/2006' AND BOS_AR_Customer.dtmLastUpdated <='9/21/2007'And it was also working fine, the result was also correct--pay attention dudes the date format is mm/dd/yyyyThen I try to change the date format to dd/mm/yyyy in the where clause like this (because later I realized that, this is the query that gonna be used):WHERE BOS_AR_Customer.dtmLastUpdated >= '1/8/2006' AND BOS_AR_Customer.dtmLastUpdated <='21/9/2007'The result was an error message saying:"The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."Can you tell me whats wrong, please. I appreciate anykinds of help guys, thanks. FYI : I use SQL SERVER 2000 Best Regards.
View 1 Replies
View Related
Jul 6, 2005
I'm having trouble getting a query to run that contains an IF statement:
*****************************************
DECLARE @lid int, @ptf varchar(50)
SET @lid = 3
set @ptf = '05-00005'
SELECT
tblInfoData.PTFileNumber AS [PT File Number],
IF @lid > 3
BEGIN
tblInfoData.OrigGrantor AS [Original Grantor],
END
tblPropertyData.propStreet AS [Property Address],
tblPropertyData.propCity AS City,
tblPropertyData.propState AS State,
tblPropertyData.propZip AS Zip,
tblSaleData.OrigSaleDate AS [Original Sale Date],
tblInfoData.Status AS Status
FROM tblInfoData INNER JOIN
tblPropertyData ON tblInfoData.PTFileNumber = tblPropertyData.PTFileNumber INNER JOIN
tblSaleData ON tblInfoData.PTFileNumber = tblSaleData.PTFileNumber
WHERE CONTAINS(tblInfoData.PTFileNumber, @ptf)
*********************************************
This throws the following error in Query Analyser:
Server: Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'IF'.
Server: Msg 170, Level 15, State 1, Line 14
Line 14: Incorrect syntax near 'tblInfoData'.
Any help/ideas?
thanx
</c>
View 6 Replies
View Related
May 23, 2007
While MOM processes are running at some point, a process goes into deadlock and uses up all existing CPUs.
Sysprocesses shows this it opened up 4 threads and program name is Microsoft® Reliability Analysis Service.
Profiler doesn't show which command it was trying to execute, but last notable command which has started was MRAS_pcLoad EXECUTE @i_Return_Code = sp_getapplock @Resource = N'MOM.Datawarehousing.DTSPackageGenerator.exe', @LockMode = N'Exclusive', @LockOwner = N'Session', @LockTimeout =
Can you please help us, what could be the problem. It has been running fine till couple of days back.
--Prabhu
View 5 Replies
View Related
Jul 25, 2002
I am running trace with properies
Event classes
--> Exeptions
-->TSQL (all events)
result
event class text
----------- ----
exeption Error: 2627, Severity: 14, State: 1
What event classes should be added to capture what cause this error ?
from BOL
----------------------------------------------------------------
Severity Levels 11 through 16
These messages indicate errors that can be corrected by the user.
(2627 14 Violation of %ls constraint '%.*ls'. Cannot insert duplicate key
in object '%.*ls'. )
------------------------------------------------------------------
Alex
View 2 Replies
View Related
Sep 19, 2005
Can anyone explain what's wrong with this code which is supposed to populate a dropdownlist using a parametised stored procedure and SqlDataAdapter?
objCmd = new SqlCommand("bs_GetActivityValueTypes", objConn.GetConnection()); objCmd.Parameters.Add("@scid", SqlDbType.Int);objCmd.Parameters["@scid"].Value = Convert.ToInt32(Request.QueryString["scorecard"].ToString()); objAdapter = new SqlDataAdapter(objCmd);objAdapter.Fill(dsInitData, "tblValueTypes");
comboResultType.DataSource = dsInitData.Tables["tblValueTypes"]; comboResultType.DataValueField = "Type_ID";comboResultType.DataTextField = "Type_Desc";comboResultType.DataBind(); comboResultType.Items.Insert(0, new ListItem("- Select a value type -", ""));Basically, if I remove the parameter from the code and the stored procedure it works fine, but when I add the parameter back I get an "Incorrect syntax near 'bs_GetActivityValueTypes'" error at line: objAdapter.Fill(dsInitData, "tblValueTypes"); This makes no sense to me because I know the stored procedure is well formed and I've used almost identical code elsewhere. All variables are declared further up the code. Someone help please!
View 3 Replies
View Related
Oct 12, 2007
Hi,
I already had a thread for same problem but didn't recieved any response in last 4-5 months so I created a new thread for this
I am using service broker in between two database servers. following is the way i am sending and receiving messages
Send
BEGIN TRAN
BEGIN DIALOG CONVERSATION @handle
FROM SERVICE @SendService
TO SERVICE @ReceiveService
ON CONTRACT @Contract
WITH LIFETIME = @lifetime;
SEND ON CONVERSATION @handle
MESSAGE TYPE @xmlMessageType(@xmlMessage);
COMMIT
Receive
BEGIN TRAN;
RECEIVE TOP(1) @xmlMessage = message_body,
@handle = conversation_handle,
@message_type = message_type_name
FROM TransactionQueue;
----------------------------------------------------------------------------------------------------
-- Check to make sure a message was returned to process. In theory this should never happen.
----------------------------------------------------------------------------------------------------
IF @@rowcount = 1
BEGIN
IF @message_type = 'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
BEGIN
END CONVERSATION @handle;
COMMIT
RETURN 0
END
IF @message_type = N'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
BEGIN
RAISERROR(N'Received error %s from service [Target]', 10, 1)
END CONVERSATION @handle;
COMMIT
RETURN 0
END
SET @sql = 'EXEC '+@message_processor_name+' @xml'
BEGIN TRAN
EXEC sp_executesql @sql, N'@xml XML', @xml=@xmlMessage
COMMIT TRAN
END CONVERSATION @handle;
END
COMMIT
I see Messages are delivered to the target every thing working fine other than following errors which i am seeing in profiler.
1) "This message could not be delivered because the conversation endpoint has already been closed." I see this error on initiator end. Is it like ending conversation on initiator end when i get "EndDialog" send an acknowledgement, which cannot be recieved by target as it has already ended conversation.
2) "An error occurred while receiving data: '64(The specified network name is no longer available.)'." I don't have much idea about the reason for this error. But in profiler i see value for GUID is different for this error and the real message.
Let me know if you need any other information
View 2 Replies
View Related
Aug 10, 2015
I am doing a distinct count on a related table's column, but get an out of memory error if I run it for the entire table (works great for just a few rows when filtered down).The error I get is: "We couldn't get data from the external source.The operation has been cancelled because there is not enough memory available for the application. If using 32-bit version of the product consider upgrading.
I know I can add a related column and that works fine...but that seems to me like I've defeated the purpose, I have a good and proper lookup table, and should be able to run my query against its relationship.Here is the query and details below *Note I supplied a scaled down sample, on my actual model I receive these errors, not in the sample as it has only a few rows
List Workers Distinct Project Customers:=CALCULATE(DISTINCTCOUNT(Projects[CustomerID]),'WorkersToProjects')
Other measure which returns no errors, but included for completeness:
List Workers Projects:=CALCULATE(DISTINCTCOUNT([ProjectID]),ISBLANK(WorkersToProjects[ProjectID])=FALSE())
My goal here is to allow the user to view the workers assigned to a project, but also get counts of the workers assigned to the CUSTOMER of a project. For example, suppose we lose a customer, we want to see how many workers would be impacted by that, so a count of projects per worker is not useful there, we need to see a count of workers per project's customer (owner of project whom project work is being done for)The question being: How can I accomplish this:
1. WITHOUT adding a calculated column to WorkersToProjects (of Projects.CustomerID)
2. WITH better performance?
There must be a better way to write this DAX to still get the correct answer?*Pic of pivot table, again, the numbers are accurate but the formula used to List Workers Distinct Project Customers measure does NOT scale :( 3 count for red , the number of Projects John has and 2 count for blue, the unique customers/owners of those projects "Veridian Dynamics" and "Massive Dynamic". URL....
View 3 Replies
View Related
Jan 16, 2008
I€™m facing a SQL batch insert issue on Windows 64 bit (IA-64) platform. I€™m using €˜Column-Wise Binding€™ of parameters. The example program hosted on Microsoft site (http://msdn2.microsoft.com/en-us/library/ms709287.aspx) returns error of SQL_NEED_DATA for batch insert on Windows 64 bit platform. The same code works fine on 32 bit platform. I€™m using SQL Server 2000 as the database and tried using both native SQL server ODBC driver and Merant 5.2 ODBC drivers. Any help on this will be greatly appreciated.
View 5 Replies
View Related
Dec 28, 2007
If a stored procedure creates a temporary table and then has a batch-terminating error -- either a fatal error or a non-fatal error in "xact_abort on" mode -- the temp table does not get dropped even though it goes out of scope:
create proc px as
create table #z(z1 int primary key)
insert #z values ('x')
go
exec px
go
select * from tempdb.sys.tables where name like '#z%' --returns row for #z
drop table #z --fails because #z out of scope
or:
create proc px as
set xact_abort on
create table #z(z1 int primary key)
insert #z values (0)
insert #z values (0)
go
exec px
go
select * from tempdb.sys.tables where name like '#z%' --returns row for #z
drop table #z --fails because #z out of scope
Is this behavior by design? It does not appear to be documented properly if so, since BOL states that "Temporary tables are automatically dropped when they go out of scope".
In any case, is there a way to delete leftover temp tables from tempdb without restarting SQL Server?
Thanks,
Ron
View 2 Replies
View Related
Feb 12, 2008
Hi,
We currently have a SSIS package which is using a batch script . This batch script actually executes on TERADATA server and loads data in to terdata db. We did not get access to UNIX env so we are planning to create SSIS packages that can call the batch scripts and perform tasks on terdata.
Can somebody throw some light how to caputure the information if there is error in batch script or data loading and send a mail.
Ealrier we created packages that were doing data loading on SQL server and if something fails then we used error handling machanism in stored procedures which logs failure event in to SQL table and then using send mail task it send a email.
I nwant to know how to use error handling when something fails on terdata and send mail to us.
View 4 Replies
View Related
Sep 24, 2006
Hey guys,
I have a Access adp that backs onto SQL Server 2005, its taken a while but tis nearly done.
Just one last thing to figure out.. and thats how to send a email. I had a look at all the Access ways and they just wont work out for this.
So I decided to use the server to send them, I would insert/update a row into a table which has a trigger on it.
The table has amoung other things a Approved and Declined column.
Both at 0 Sends an email to an Approver
App 1 Dec 0 Sends on further
and App 0 Dec 1 sends back to the original sender.
All I really want to know is could a trigger execute a package or something that will send the email? (Yes thats right someone isnt asking for code for once:D meh must be winter in hell)
If theres any flaws in my idea please feel free to tell me (Saves me denting the desk with my head half a week and 10 pages of code from now)
And where do I create triggers:P (Will probly have found this one in BOL by the time anyone replys)
Sorry about this but I really have no clue about triggers.. seems the site doesnt like me searching for triggers
'This page was generated in 17.03 seconds.'
:P
View 2 Replies
View Related
Jan 21, 2008
TITLE: Connect to Server
------------------------------
Cannot connect to xxx
ADDITIONAL INFORMATION:
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.
Client unable to establish connection
Encryption not supported on the client.
(pfutil90)
------------------------------
BUTTONS:
OK
------------------------------
timely help is much appreciated
View 1 Replies
View Related
Apr 23, 2008
Hi
i have a comment column which is varchar(200). when a user types any say for example a couple of small paragraph with commas , colon, hard enter key.
when i run a select statement and save it to csv file and then open with excel, if the comments has comma then i get these info in separate column and if there is hard enter key then it goes into new line.
Is there a way to get these info in one column
Thanks,
View 2 Replies
View Related
Jul 20, 2005
Hai friendsCould u pleas give me some noites on replication . I worked out thruwizards but not succeded.With thanksRaghu
View 1 Replies
View Related
Mar 26, 2008
Hello,
can I create a comment for a table in SQL Server 2005? For a column I can create a comment in the description-field.
finchen
View 3 Replies
View Related
Apr 30, 2007
Plesae tell me the MSSQL Server equivalent of the below MySQL query .create table temp2(a varchar(23) comment 'male m');What is the use of specifying a keyword 'comment' in the column definition. Will it make any difference
View 14 Replies
View Related