How to interpret RecordID Data Type via the SQL statement?

igor.chladil
Member Posts: 28
Hello,
I have NAV5 SP1 DB on SQL2005.
I need to do some search via SQL SELECT statement using the RecordID field in the WHERE clause. When I have tried to convert the VARBINARY representation of RecordID on SQL it didn't look like some reasonable text. Could anybody please suggest what the VARBINARY SQL representation really means and what is really stored in there and how it is stored?
Thanks ahead for your replies.
Regards,
Igor Chladil
I have NAV5 SP1 DB on SQL2005.
I need to do some search via SQL SELECT statement using the RecordID field in the WHERE clause. When I have tried to convert the VARBINARY representation of RecordID on SQL it didn't look like some reasonable text. Could anybody please suggest what the VARBINARY SQL representation really means and what is really stored in there and how it is stored?
Thanks ahead for your replies.
Regards,
Igor Chladil
0
Comments
-
Please read this blog on details of record link
http://blogs.msdn.com/microsoft_dynamic ... erver.aspx0 -
Here is some code in C# that I used to get the record link info from the Item table. Hopefully it will help someone.
String itemNumber = "0310100";
String rlKey = "0x1B00000000890" + itemNumber.Length.ToString() +
ConvertToHex(itemNumber) + "000000";
// build the [Record ID] string in hex
// limitations - this only works for links on the item table where Item.No_ length is less
// than 10. I'm sure there is a function to convert length it's binary value and
// if you wanted it to work for other tables you would have to change the first part of the string
String commandText;
commandText = "SELECT [Description], [URL1] from [yourdatabase].[dbo].[Record Link] where sys.fn_varbintohexstr([Record ID]) = '" + rlKey.Trim() + "'";
adp.SelectCommand = new SqlCommand(commandText, cn);
adp.Fill(dt);
// here is the code for the ConverToHex
private string ConvertToHex(string asciiString)
{
string hex = "";
foreach (char c in asciiString)
{
int tmp = c;
hex += String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString()));
}
return hex;
}Joe0 -
TableFilter data type works similar.
Is there some documentation that specifies the mapping TableFilter hexadecimal string?
Thank you0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions