Wednesday, March 21, 2012
Diff Result Between SQL 7 & SQL 2000
When I execute the following sql statement in SQL 2000 DTS or query analyzer, I received the following error message. I used [ ] because my field names have spaces in between.
The same sql statement ran perfect in SQL 7. What could be wrong? Please advise. Thanks a million.
Update SAPvsSQL set [Sales Organisation] = sales_org,
[Value Out By] = val_diff, [Qty Out By] = qty_diff
Error message:
Server: Msg 16882, Level 11, State 1, Procedure sp_runwebtask, Line ...
SQL Web Assistant: Web task not found. Verify the name of the name for possible errors.
Best regardsYou sure you just didn't execute all of the code in the QA window, and you're executing something you don't see?|||And also, what are you setting the columns to?
Those aren't local variables...is there more to the statement?|||Originally posted by Brett Kaiser
And also, what are you setting the columns to?
Those aren't local variables...is there more to the statement?
Hi,
Thank you for your email reply.
Those in [ ] were actual field names in my database table. I used them for display purposes so instead of showing Sales_organation, I display Sales Organisation, Value Out By instead of val_diff and finally Qty Out By instead of qty_diff (look more meanful to the users).
You are right that I didn't show all the script in my previous message because they worked ok until this line. I am just being curious why the same script work PERFECT in SQL 7 but not in SQL 2000. I have been running this same set of script for more than a year and still running fine as at this morning. Reason why I am trying it on SQL 2000 because we will be moving to SQL 2000 totally by end this month.|||No problems here...your doing something else wrong...
USE Northwind
GO
CREATE TABLE SAPvsSQL (
[Sales Organisation] varchar(10)
, [Value Out By] varchar(10)
, [Qty Out By] varchar(10)
)
GO
DECLARE @.Sales_Org varchar(10), @.val_diff varchar(10), @.qty_diff varchar(10)
SELECT @.Sales_Org = 'A', @.val_Diff = 'B', @.qty_diff = 'C'
INSERT INTO SAPvsSQL ([Sales Organisation], [Value Out By], [Qty Out By])
SELECT 'X', 'Y', 'Z'
SELECT * FROM SAPvsSQL
UPDATE SAPvsSQL
SET [Sales Organisation] = @.sales_org
, [Value Out By] = @.val_diff
, [Qty Out By] = @.qty_diff
SELECT * FROM SAPvsSQL
GO
DROP TABLE SAPvsSQL
GO
Didn't show part of rows at subscriber
I'm confuse knowing that some rows didn't replicated to subscriber. No error, no message, no idea at all.
Is there any workaround to do? I'm not sure to have resnapshot because of the large data and long distance site.
I'm using simple merge replication. No filter or any modified things.
Pls help.
TIA
Echo,
I've seen this in 2 circumstances. Firstly when the filter was set to 1=2
and inserts were made while the merge agent was running and secondly when a
bulk insert was carried out without firing the triggers.
To fix the extra rows that haven't been replicated, there are 2 different
procedures (details in BOL):
SP_MERGEDUMMYUPDATE
SP_ADDTABLETOCONTENTS
HTH,
Paul Ibison
|||>Firstly when the filter was set to 1=2 and inserts were made while the merge agent was running
- I don't have any idea. No filter at all.
>secondly when a bulk insert was carried out without firing the triggers
- Do you mean the triggers those made by replication? why didn't they fire?
Still don't know how to use sp_mergedummyupdate or sp_addtabletocontents.
What to fill in the parameters?
Thanks a lot Paul

"Paul Ibison" wrote:
> Echo,
> I've seen this in 2 circumstances. Firstly when the filter was set to 1=2
> and inserts were made while the merge agent was running and secondly when a
> bulk insert was carried out without firing the triggers.
> To fix the extra rows that haven't been replicated, there are 2 different
> procedures (details in BOL):
> SP_MERGEDUMMYUPDATE
> SP_ADDTABLETOCONTENTS
> HTH,
> Paul Ibison
>
>
|||Echo,
The triggers I was referring to are the replication triggers. On an insert,
a record should be entered into MSmerge_contents and this is done using a
trigger. The trigger won't fire on a bulk insert (by default).
The dummy update takes 2 arguments - the tablename and the guid of the row
which didn't replicate and works for single
rows(http://msdn.microsoft.com/library/de...y/en-us/tsqlre
f/ts_sp_repl3_7r6t.asp).
Sp_addtabletocontents will do this work for an entire table
(http://msdn.microsoft.com/library/de...-us/tsqlref/ts
_sp_repl_05wz.asp) and just has the table and owner as arguments.
In each case, doing the synchronization afterwards is necessary.
HTH,
Paul Ibison
Monday, March 19, 2012
DialogError message type
Hi There
In my testing i have seen the following i just would like confirmation that i am correct.
When something happens to cause a Dialog Error say for example message validation fails.
I have noticed that the actual DialogError message always goes to the initiator queue, is this correct ?
If so then logic to handle the ErrorDialog message type only has to be in the initiator activated SP that logic is not required in the target queue activated SP since the ErrorDialog message always goes to the initiator queue, is that correct ?
Thanx
Both sides need to be prepared to deal with the error message. The same message validation can fail for a message sent on the other direction, or the initiator code can issue an explicit END CONVERSATION ... WITH ERROR (or even an ALTER DATABASE ... SET ERROR_BROKER_CONVERSATIONS), or the initiator can drop the contract used on the conversation, or the service. All these result in an error message being sent to the target, and the list is not complete.
HTH,
~ Remus
Dialog Security and Message Encryption
I understand that Dialog Security + certificates can be used to encryption individual dialogs. I have several demos working now that do just this.However, I don't fully understand exactly when the messages are encrypted, and if they are ever written to a queue on the initiating service prior to being encrypted. I want to make sure that admins can't simply query the transmission queues to get clear text messages, because I have strict requirements that I encrypt all personal data that is stored anywhere in a database.
BOL is a little unclear on this topic. The relevant doc reads:
For a dialog that uses security, Service Broker encrypts all messages sent outside a SQL Server instance. Messages that remain within a SQL Server instance are never encrypted. In dialog security, only the database that hosts the initiating service and the database that hosts the target service need to have access to the certificates used for security. That is, an instance that performs message forwarding is not required to have the capability to decrypt the messages that the instance forwards.
Does this imply that message destined for an external service aren't encrypted until they leave the instance? Or does Service Broker figure out that the message is destined for a remote service and therefore applies encryption to the message_body prior to the message hitting the transmission queue on the initiating service?
Many thanks, Kevin
Messages are encrypted only in traffic, as they are transmitted over the network. You cannot prevent an administrator (or user with proper permissions) from seeing the clear text of the messages in the transmission_queue. Storing the messages encrypted in the transmission_queue has several weaknesses/issues:
- it breaks cryptographic best practices as same cipher is sent over and over again in case of retries
- the message clear text can still be seen in the SEND statement T-SQL batch (and this can be monitored for)
- the message clear text can still be seen in the destination queue
In your case you have to use the encryption infrastructure of SQL Server (EncryptByKey, DecryptByKey) to encrypt/decrypt the sent payload, or do the encryption in the application code.
But since message data is ultimately originating from a table and usually is being stored (after RECEIVE) in a table, you have the requirement to store the data encrypted anyway, irellevant of Service Broker. IMHO the best option is to sent directly the encrypted data, as is stored in the table.
HTH,
~ Remus
Thanks, that's kind of what I expected. I will define some sort of envelope message that includes the encrypted payload.
Out of curiosity, what format is the message_body column in when I query a queue? Is there any way I can decode that to see the actual xml? I'll need to demo that the payload is encrypted.
Cheers, Kevin
|||No encoding, just serialized. Is a simple VARBINARY(MAX). Doing a SELECT CAST(MESSAGE_BODY AS XML) FROM sys.transmission_queue will show the correct XML. The 0xFFFE at the beginning is the XML Byte Order Mark for UTF-16.|||Remus Rusanu wrote:
But since message data is ultimately originating from a table and usually is being stored (after RECEIVE) in a table, you have the requirement to store the data encrypted anyway, irellevant of Service Broker. IMHO the best option is to sent directly the encrypted data, as is stored in the table.
I've been thinking about this and I'm going to have to correct myself. Sending directly the ecrypted column and storing received data as the encrypted column would require that the same key is used on both sites. This is a bad cryptographic practice and also can turn into a key maintainance nightmare when the keys are changed.
There should be a key to store the data on one site. This key must be used to decrypt the data before sending. The decrypted data should be encrypted it with a dedicated transmition key. The transmission key has to be shared or exhanged by the two parties involved. The receiver should use this transmission key to decrypt the payload. The decrypted payload should be then encrypted with the receiver's own 'storage' key.
I know there are a lot of encrypt/decrypt steps involved, but sharing the key between the sender and receiver can be dangerous/problematic.
The main problem is that the 'transmission' key must be somehow exchanged by the sender and receiver, this is not a trivial operation. One example can be as follows: for instance this 'transmission' key could be the first message sent on a conversation. For each conversation, the sender can generate and create a random symmetric key (later used to encrypt message on this conversation), then send it to the target encrypted with the target's public key (the very same one used to set up dialog security/REMOTE SERVICE BINDING). The receiver when it receives the first message it decrypts it (since it has the corresponding private key), creates a symmetric key from the received secret and later can use this symmetric key to decrypt message on this conversation. When a conversations is closed, its 'transmission' symmetric keys can be removed.
Other typical cryptographic precautions (signing/timestamping the transmission key, adding a nonce/chanlenge etc) I believe are not necessary, because you already have authentication from the dialog security itself.
HTH,
~ Remus
P.S. Kevin, you seem to know a thing or two about this subject and maybe you already knew all this, but I have to think at all the other people looking at the post.
|||Many thanks Remus. I am intending to use a different set of keys for transmission encryption. The messages should have a much shorter lifetime that the data that gets mapped into the production tables, so I don't want to couple the data storage keys with the transmission keys.
I hadn't thought about using an initial exchange of messages in order to establish a symmetric key for encryption -- sounds just like what SSL does. Of course, I will also need to encrypt the transmission symmetric key when it is stored locally, but SQL 2k5 seems to have plenty of options there.
Cheers, Kevin
Friday, March 9, 2012
device is ambiguous in the namespace microsoft.directx.direc3d
I have checked and double checked that I have all the necessary references and includes. Obviously I am missing something.
Thanks Dick
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class Form1
Inherits System.Windows.Forms.Form
Dim device As Device ' Our rendering device
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
#End Region
Public Function InitializeGraphics() As Boolean
Try
' Now let's setup our D3D stuff
Dim presentParams As PresentParameters = New PresentParameters()
presentParams.Windowed = True
presentParams.SwapEffect = SwapEffect.Discard
device = New Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams)
Return True
Catch
Return False
End Try
End Function
Private Sub Render()
If device Is Nothing Then
Exit Sub
End If
'Clear the backbuffer to a blue color
device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0F, 0)
'Begin the scene
device.BeginScene()
' Rendering of scene objects can happen here
'End the scene
device.EndScene()
device.Present()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not InitializeGraphics() Then
MessageBox.Show("Could not initialize Direct3D. This tutorial will exit.")
Exit Sub
End If
Me.Show()
' While the form is still valid, render and process messages
Do While Me.Created
Render()
Application.DoEvents()
Loop
End Sub
End Class
This is a SQL Server forum. I think you've accidentally posted to the wrong place...Wednesday, March 7, 2012
device is ambiguous in the namespace microsoft.directx.direc3d
I have checked and double checked that I have all the necessary references and includes. Obviously I am missing something.
Thanks Dick
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class Form1
Inherits System.Windows.Forms.Form
Dim device As Device ' Our rendering device
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
#End Region
Public Function InitializeGraphics() As Boolean
Try
' Now let's setup our D3D stuff
Dim presentParams As PresentParameters = New PresentParameters()
presentParams.Windowed = True
presentParams.SwapEffect = SwapEffect.Discard
device = New Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams)
Return True
Catch
Return False
End Try
End Function
Private Sub Render()
If device Is Nothing Then
Exit Sub
End If
'Clear the backbuffer to a blue color
device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0F, 0)
'Begin the scene
device.BeginScene()
' Rendering of scene objects can happen here
'End the scene
device.EndScene()
device.Present()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not InitializeGraphics() Then
MessageBox.Show("Could not initialize Direct3D. This tutorial will exit.")
Exit Sub
End If
Me.Show()
' While the form is still valid, render and process messages
Do While Me.Created
Render()
Application.DoEvents()
Loop
End Sub
End Class
This is a SQL Server forum. I think you've accidentally posted to the wrong place...Tuesday, February 14, 2012
Determining table for a particular File_id:Page_No
I have a deadlock message and I can not figure out the resource that the
SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
1204):
PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
the page number but my question is:
How do I determine the table that this page belongs to?
Thanks in advance,
Tom
You can use DBCC PAGE. Google and you will find how to use it. It will return object id in page
header. Use the function OBJECT_NAME() to convert from id to name.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"TJT" <TJT@.nospam.com> wrote in message news:OKdyoeFqFHA.1096@.TK2MSFTNGP11.phx.gbl...
> Hello,
> I have a deadlock message and I can not figure out the resource that the
> SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
> 1204):
> PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
> I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
> the page number but my question is:
> How do I determine the table that this page belongs to?
> Thanks in advance,
> Tom
>
|||try...
dbcc traceon (3604)
dbcc page(11,3,4791032)
read page header, find m_objId
Aleksandar Grbic
MCDBA, Senior Database Administrator
"TJT" wrote:
> Hello,
> I have a deadlock message and I can not figure out the resource that the
> SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
> 1204):
> PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
> I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
> the page number but my question is:
> How do I determine the table that this page belongs to?
> Thanks in advance,
> Tom
>
>
Determining table for a particular File_id:Page_No
I have a deadlock message and I can not figure out the resource that the
SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
1204):
PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
the page number but my question is:
How do I determine the table that this page belongs to?
Thanks in advance,
TomYou can use DBCC PAGE. Google and you will find how to use it. It will return object id in page
header. Use the function OBJECT_NAME() to convert from id to name.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"TJT" <TJT@.nospam.com> wrote in message news:OKdyoeFqFHA.1096@.TK2MSFTNGP11.phx.gbl...
> Hello,
> I have a deadlock message and I can not figure out the resource that the
> SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
> 1204):
> PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
> I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
> the page number but my question is:
> How do I determine the table that this page belongs to?
> Thanks in advance,
> Tom
>|||try...
dbcc traceon (3604)
dbcc page(11,3,4791032)
read page header, find m_objId
--
Aleksandar Grbic
MCDBA, Senior Database Administrator
"TJT" wrote:
> Hello,
> I have a deadlock message and I can not figure out the resource that the
> SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
> 1204):
> PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
> I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
> the page number but my question is:
> How do I determine the table that this page belongs to?
> Thanks in advance,
> Tom
>
>
Determining table for a particular File_id:Page_No
I have a deadlock message and I can not figure out the resource that the
SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
1204):
PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
the page number but my question is:
How do I determine the table that this page belongs to?
Thanks in advance,
TomYou can use DBCC PAGE. Google and you will find how to use it. It will retur
n object id in page
header. Use the function OBJECT_NAME() to convert from id to name.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"TJT" <TJT@.nospam.com> wrote in message news:OKdyoeFqFHA.1096@.TK2MSFTNGP11.phx.gbl...seagreen">
> Hello,
> I have a deadlock message and I can not figure out the resource that the
> SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
> 1204):
> PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
> I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
> the page number but my question is:
> How do I determine the table that this page belongs to?
> Thanks in advance,
> Tom
>|||try...
dbcc traceon (3604)
dbcc page(11,3,4791032)
read page header, find m_objId
Aleksandar Grbic
MCDBA, Senior Database Administrator
"TJT" wrote:
> Hello,
> I have a deadlock message and I can not figure out the resource that the
> SPID is waiting on. I see a message in the ErrorLog (running Trace Flag
> 1204):
> PAG: 11:3:4791032 CleanCnt:1 Mode: IX Flags: 0x2
> I know that the 11 is the database ID and 3 is the file_ID and 4791032 is
> the page number but my question is:
> How do I determine the table that this page belongs to?
> Thanks in advance,
> Tom
>
>