User defined table types sometimes show up a unknown data type in Profiler
A couple of our users have a problem when using user defined table types. Calls are made using UDTT as variables and these are then passed to a stored procedure as parameters. Sometimes the application returns a timeout. In such situations a Profiler-Trace
shows the following:
declare @p4 unknown
whereas the correct trace (that is sometimes displayed) should be:
declare @p4 dbo.ReportFilterTableType
ReportFilterTableType is a UDTT. The users do have correct permissions for the UDTT (otherwise they would never be usable for the user). What could be the reason that the data types for the variable
@p4 in the example are sometimes returned as unknown and at other times are returned correctly as
ReportFilterTableType? Could this possibly be a network related issue?
Thank you.
Graham Goodwin Email: [email protected]
I know this is a old post, but i am also facing the same issue that too in my production server. Did you find any workarround for this issue. Please do reply. Critical problem we are facing.
Alka, Is your problem timeouts when passing TVP parameters, or is it that a Profiler Trace shows type "unknown" for the TVP data type name?
If your problem is timeouts, be aware that TVPs do not have statistics so the optimizer might not be able to generate an optimal plan for non-trivial queries. Declaring a primary key or unique constraint on the table type may help since that will provide
useful cardinality information. You may need to resort to hints in some cases.
I suggest you start a new thread with details of your specific situation if the information in this thread doesn't help.
Dan Guzman, SQL Server MVP, http://www.dbdelta.com
Similar Messages
-
Syntax error when creating a user-defined table type in SQL Server 2012
Why am I getting a syntax error when creating a user-defined table type in SQL Server 2014?
CREATE TYPE ReportsTableType AS TABLE
( reportId INT
, questionId INT
, questionOrder INT );
Results:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'AS'.Hope these posts could help,
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/37a45a9a-ed8c-4655-be93-f6e6d5ef44be/getting-incorrect-syntax-while-creating-a-table-type-in-sql-server-2008-r2?forum=transactsql
Regards, Dineshkumar,
Please Mark as Answer if my post answers your question and
Vote as Helpful if it helps you -
User defined table type output not coming
hi all,
i have a userdefined type delcared as:
create or replace TYPE SAMPLE_SEARCH AS OBJECT (
-- LIST OF VARIABLE NAMES AND RESPECTIVE DATA TYPE
i have a user defined table type defined as:
create or replace TYPE SAMPLE_SEARCH_TABLE IS TABLE OF SAMPLE_SEARCH;
I have a stored proc which has an output paramter of type SAMPLE_sEARCH_TABLE.
that is,
sp_sample_proc(sample_search_tb OUT SAMPLE_SEARCH_TABLE);
When i invoke the above stored proc from an anonymous pl/sql block , how can i display the contents of the output parameter using dbms_Output statements?Try this.........This is just a sample code.
CREATE OR REPLACE TYPE address1 AS OBJECT
(country VARCHAR2(1000),
city VARCHAR2(1000),
zip NUMBER,
add1 VARCHAR2(4000),
add2 VARCHAR2(4000));
CREATE OR REPLACE TYPE t_addObj IS TABLE OF address1;
CREATE OR REPLACE PROCEDURE Sp_Address_Obj(Out_Add_Obj OUT t_Addobj) IS
v_Addobj t_Addobj := t_Addobj();
BEGIN
SELECT Address1(u.Object_Name,
u.Object_Type,
u.Object_Id,
'Add01' || Rownum,
'Add02' || Rownum) BULK COLLECT
INTO v_Addobj
FROM User_Objects u;
Out_Add_Obj := v_Addobj;
END Sp_Address_Obj;
DECLARE
v_Addobj t_Addobj := t_Addobj();
BEGIN
Sp_Address_Obj(v_Addobj);
Dbms_Output.Put_Line(v_Addobj(1).City);
FOR i IN 1 .. v_Addobj.Count LOOP
Dbms_Output.Put_Line(v_Addobj(i).Country || '-' ||
v_Addobj(i).City || '-' ||
v_Addobj(i).Zip || '-' ||
v_Addobj(i).Add1 || '-' ||
v_Addobj(i).Add2);
END LOOP;
END; -
How do i declare a user defined table type sproc parameter as a local variable?
I have a procedure that uses a user defined table type.
I am trying to redeclare the @accountList parameter into a local variable but it's not working and says that i must declare the scalar variable @accountList.this is the line that is having the issue: must declare the scalar variable @accountListSET @local_accountList = @accountListALTER PROCEDURE [dbo].[sp_DynamicNumberVisits] @accountList AS integer_list_tbltype READONLY
,@startDate NVARCHAR(50)
,@endDate NVARCHAR(50)
AS
BEGIN
DECLARE @local_accountList AS integer_list_tbltype
DECLARE @local_startDate AS NVARCHAR(50)
DECLARE @local_endDate AS NVARCHAR(50)
SET @local_accountList = @accountList
SET @local_startDate = @startDate
SET @local_endDate = @endDate
CREATE TYPE [dbo].[integer_list_tbltype] AS TABLE(
[n] [int] NOT NULL,
PRIMARY KEY CLUSTERED
[n] ASC
)WITH (IGNORE_DUP_KEY = OFF)
GOWhy are you asking how to be an awful SQL programmer?? Your whole approach to SQL is wrong.
We have a DATE data type so your insanely long NVARCHAR(50) of Chinese Unicode strings is absurd. Perhaps you can post your careful research on this? Can you post one example of a fifty character date in any language?
The use of the "sp_" prefix has special meaning in T-SQL dialect. Good SQL programmers do not use CREATE TYPE for anything. It is dialect and useless. It is how OO programmers fake it in SQL.
The design flaw of using a "tbl-" prefix on town names is called "tibbling" and we laugh at it.
There are no lists in RDBMS; all values are shown as scalar values. First Normal Form (1NF)? This looks like a set, which would have a name.
In any -- repeat any -- declarative programming language, we do not use local variables. You have done nothing right at any level. You need more help than forum kludges.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
User-Defined Table Types - Where is it in SQL Server 2008?
I am having 2 issues:
1. I don't see a folder for 'User-Defined Table Types' under programmability-->Types
2. When I execute the following code to create a Type; I get an error 'Incorrect syntax near the keyword 'AS'.'
USE Locations;
GO
/* Create a user-defined table type */
CREATE TYPE LocationTableType AS TABLE
( LocationName VARCHAR(50)
, CostRate INT );
GOHi Shayann,
The user-defined table type is a new
feature from SQL Server 2008. If you want to use it you have to upgrade your database to SQL Server 2008 or above.
In you scenario(SQL Server 2005),as a workaround, you can use the local temporary table instead.
--in SQL Server 2005
CREATE TABLE tblType(id INT,name VARCHAR(99))
GO
CREATE PROC proc1
AS
BEGIN
SELECT * FROM #temp;
END
GO
SELECT * INTO #temp FROM tblType; -- the #temp name is fixed
INSERT INTO #temp VALUES(1,'Eric');
EXEC proc1
--In SQL Server 2008 or above
CREATE TYPE LocationTableType AS TABLE
( id INT,
name VARCHAR(99) );
GO
CREATE PROC proc1 @t LocationTableType READONLY
AS
BEGIN
SELECT * FROM @t
END
GO
DECLARE @t LocationTableType;
INSERT INTO @t VALUES(1,'Eric');
EXEC proc1 @t
I still suggest you upgrade to higher SQL Server.
If you have any question, feel free to let me know.
Best regards,
Eric -
What is the Object Type for User Define table ?
Dear All Experts,
I create one of the User Define Table with no. of UDF's
I already register User Define Table with Unique ID.
As per my knowledge, Unique ID is our Object type for that User Define Table.
I want to add Transaction Notification Code for created Used Define Table.
This Transaction Notification prevents user to must enter name in that form.
IF (@object_type = 'Z_Roto' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U'))
BEGIN
If not Exists (Select T0.DocEntry from [@Z_ROTO] T0 Where ( T0.Name is null OR T0.Name = ' ' ) AND T0.Code = @list_of_cols_val_tab_del )
begin
SET @error = 1
SET @error_message = 'Name is NULL then So, Please enter ZERO Value i.e. 0 in Filed_Name'
End
End
Please help me for this problem.
Thanks & Regards,
Nishit MakadiaHi All,
Thanks for your replay.
Below code is working for User Define Table's Transaction Notification
IF (@transaction_type = 'A' OR @transaction_type = 'U') AND @object_type = 'Z_Roto'
BEGIN
If Exists (Select T0.Code from [@Z_ROTO] T0 Where ( T0.Name is null OR T0.Name = ' ' ) AND T0.Code = @list_of_cols_val_tab_del)
begin
select @error = 10
select @error_message = 'Name is NULL then So, Please enter ZERO Value i.e. 0 in Filed_Name'
End
End
Necessary to Remember 4 Things. That are mentioned below.
1) Register User Define Table (UDT) with using "Object Registration Wizard". For Example : @object_type = 'Z_Roto'
2) When you define selection criteria then it must be compulsory for use Code Field. For Example : Select T0.Code from [@Z_Roto]
3) When you define selection criteria then it must be compulsory for use Code for @list_of_cols_val_tab_del.
4) Use error code as 10 Number
Thanks & Regards,
Nishit Makadia -
Item Code Auto Generation Based on User defined Tables
I need the Item code like
PRODUCT TYPE-ITEMGROUP-ITEMCODE-SUBITEM-BRAND-COLOR e.g .FG-01-01-00-001-00.
I created the following User define Tables and link to Item Master data
U_PRO - FOR PRODUCT TYPE
U_GROUP - FOR ITEM GROUP
U_ITEMCODE - FOR ITEMCODE
U_SUBITEM - FOR SUB ITEM
U_BRD - FOR BRAND NAME
U_COLOR - FOR COLOR
i need a formatted search in Item code to fetch the codes from the user defined table
i tried with the following
SELECT T5.[Code]'-'T2.[Code]'-'T3.[Code]'-'T4.[Code]'-'T0.[Code]'-'T1.[Code] FROM [dbo].[@BRD] T0 , [dbo].[@COLOR] T1, [dbo].[@GROUP] T2, [dbo].[@ITEMCODE] T3, [dbo].[@SUBITEM] T4, [dbo].[@PRO] T5 INNER JOIN OITM T6 ON T5.Code = T6.U_PRO WHERE
T5.[Code] = T6.[$U_PRO] AND
T2.[Code] = T6.[$ U_GROUP] AND
T3.[Code] = T6.[$U_ITEMCODE] AND
T4.[Code] = T6.[$U_SUBITEM] AND
T0.[Code] = T6.[$U_BRD] AND
T1.[Code] = T6.[$U_COLOR]
showing errors. Can any one help me regarding this. I badly need the query for Auto generation of ItemcodeHi,
How can you assign those UDF value without ItemCode in the first place?
Thanks,
Gordon -
What is the proper way to add a user-defined table in CR2008 that does not show up as a zero-version stored procedure in the Database Expert? Thank you.
Hi Tony,
Thank you for the info. Now I know what you are referring to. CR has never supported functions and we don't support the native client.
What CR does, if you add a real stored Procedure to the report what you'll see is the call SP:1. It's a default parameter that has always been there. I don't recall now why we do that but something MS required.
Try using a Command Object, once you are connected the select Command. You can type in the SQL to call the function or possibly using a SQL Expression may work also.
Thank you
Don -
Attach User define tables and view table need add to database into my add-o
Hi there,
I want to deploy an addon, there are User define tables and view table need add to database.
I need some advice on some issues..
1. Can I attach User define tables and view table need add to database into my addon.
2. I wonder which chance is properly to add them, if add these user define objects in time of install and I can't get the enough information that connect to SQL server
Thanks for any help.Hi Weerachai,
Here's an example of how to create a user-defined table in code. My suggestion would be to check if it exists when your add-on starts up and then if not, create the tables, fields and objects.
'User Table
Private Sub CreateTable(ByVal sTable As String, ByVal sDescription As String, ByVal oObjectType As SAPbobsCOM.BoUTBTableType)
Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
Dim iResult As Long
Dim sMsg As String
oUserTablesMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
If Not oUserTablesMD.GetByKey(sTable) Then
oUserTablesMD.TableName = sTable
oUserTablesMD.TableDescription = sDescription
oUserTablesMD.TableType = oObjectType
iResult = oUserTablesMD.Add()
If iResult <> 0 Then
oCompany.GetLastError(iResult, sMsg)
MessageBox.Show("Error Creating Table: " & sTable & " Error: " & sMsg)
End If
End If
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTablesMD)
End Sub
'User Field
Private Sub CreateField(ByVal sTable As String, ByVal sName As String, ByVal sDescription As String, _
ByVal iSize As Integer, ByVal aFieldType As SAPbobsCOM.BoFieldTypes, _
ByVal aSubType As SAPbobsCOM.BoFldSubTypes, ByVal sLink As String, _
ByVal bMandatory As SAPbobsCOM.BoYesNoEnum)
Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
Dim oTable As SAPbobsCOM.UserTable
Dim iResult As Long
Dim sMsg As String
Dim i As Integer
Dim x As Integer
Dim bFound As Boolean = False
Dim oField As SAPbobsCOM.Field
oTable = oCompany.UserTables.Item(sTable)
For i = 0 To oTable.UserFields.Fields.Count - 1
oField = oTable.UserFields.Fields.Item(i)
'MessageBox.Show(oField.Name)
If oField.Name = "U_" & sName Then
bFound = True
End If
Next
System.Runtime.InteropServices.Marshal.ReleaseComObject(oTable)
If Not bFound Then
oUserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
oUserFieldsMD.TableName = "@" & sTable
oUserFieldsMD.Name = sName
oUserFieldsMD.Description = sDescription
oUserFieldsMD.Type = aFieldType
If aFieldType = SAPbobsCOM.BoFieldTypes.db_Alpha Or aFieldType = SAPbobsCOM.BoFieldTypes.db_Numeric Then
oUserFieldsMD.EditSize = iSize
Else
oUserFieldsMD.SubType = aSubType
oUserFieldsMD.Mandatory = bMandatory
End If
oUserFieldsMD.LinkedTable = sLink
iResult = oUserFieldsMD.Add()
If iResult <> 0 Then
oCompany.GetLastError(iResult, sMsg)
MessageBox.Show("Error Creating Field: " & sTable & "." & sName & " Error: " & sMsg)
End If
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserFieldsMD)
End If
End Sub
If you want to create a View I think you would have to use the RecordSet object. This will ensure that you don't have to log in to the database again
Hope it helps,
Adele -
Formatted search in the User defined table
Hi All..
I created two user defined table one is for document row and other is for document master.So in the master table created one column named as Sales order no and through formatted search call the sales order no in that column.Now i want that in my child table i want to show the those items which belongs to the selected sales order no in the master table.So how can i do that through Formatted search.Is there any query of it then please forward it..
ThanksYa Sure..
I need some quality check on the items after delivery so i am trying to manage it through the user defined tables.I created two tables first is document type ,Second is Document type rows.Now i created 5 user defined field in both the table.Now i want to call my sales order and its items in the UDT.so i created one fms and call the sales order in the Document table now when i double click on the first row after that i am able to see the new table which is the document row table .Now i need the item code and description of the selected sales order in the document rows table.So how the items and description can come in the row type table through FMS..
I hope now u r able to get my scenario.. -
No value is select from user define table
Hi ALL,
i am using B1if , i am sending data B1 to isr , i am using user define table but problem no value is select from user define table .
my table ID is @SSRPOD
<payload operation="">
<ns0:MT_POD_B1_System xmlns:ns0="http://xxxx.com/SC/B1/Dlvr/CustDlvr/ExtPrfOfDlvr">
<POD>
<Header>
<SalesOrderNumber>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_SalOrdNo" />
</SalesOrderNumber>
<ArrivalDate>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_TaxDate" />
</ArrivalDate>
<Detail>
<DOLineQuantity>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_Quantity" />
</DOLineQuantity>
<UOM>
<xsl:value-of select="$msg/BOM/BO/@SSRPOD/row/U_Unitmsr" />
</UOM>
</Detail>
</Header>
</POD>
</ns0:MT_POD_B1_System>
</payload>
I have set following things.
Inbound Channel
scenirio step identifier :z.xxxx
Inbound Channel(IPO):INB_B1_EVNT_ASYN_EVT
InboundType:Asynchronous
Process Trigger:B1Event
Identification Method: B1Event
Identification Parameter:n.a
Identifier:?????
Identifier Namespace:??????
can anyone help me?
Edited by: Sinha_Sinha on Feb 3, 2012 7:47 AMFound an authorization object was missing, that enabled the case types to show but hitting the GO button brought a page that can not be viewed in IE. on to the next hurdle..........
-
Print Layout to User Defined Table
Hello guyz..
I want a make preprinted for my user query from user defined table where the header information is from another query.
I guess, the base template User Report (system) can only show the repetitve data from one query but the header area is not,
could you help, showing the header information from another query ??
Thanks RegardsRia
The word is that you cannot use the PLD with user defined tables (i wish it was possible). So in any case to do that you have to use third party tools such as Crystal Reports and Reporting Services -
Error while adding records in user defined table
Dear all,
I am adding a record in user defined table using .add() method. the code is given below. while adding it raises the following error
"-1[Microsoft] [SQL Native Client] [SQL Server] Conversion failed when converting the nvarchar value '-3 @BG_MAILSETTINGS' to data type int. (CINF). "
All the fields are varchar date type.
Dim oUDT As SAPbobsCOM.UserTable
oUDT = oCompany.UserTables.Item("BG_MAILSETTINGS")
With oForm.DataSources.UserDataSources
oUDT.Code = "1"
oUDT.Name = "SMTPSERVER"
oUDT.UserFields.Fields.Item("U_SERVER").Value = .Item("EDTSMTPSVR").ValueEx
oUDT.UserFields.Fields.Item("U_EMAIL").Value = .Item("EDTFEMAIL").ValueEx
oUDT.UserFields.Fields.Item("U_PORT").Value = .Item("EDTSMTPPRT").ValueEx
oUDT.UserFields.Fields.Item("U_USERNAME").Value = .Item("EDTSMTPUSR").ValueEx
oUDT.UserFields.Fields.Item("U_PASSWORD").Value = .Item("EDTSMTPPWD").ValueEx
oUDT.UserFields.Fields.Item("U_AUTHENT").Value = .Item("CMBSMTPAUT").ValueEx
K = oUDT.Add
If K <> 0 Then
oCompany.GetLastError(iErrCode, sErrMsg)
MsgBox(CStr(iErrCode) & "-" & sErrMsg, vbCritical, "Error")
Exit Sub
End If
End with
Could any one please say the solution for this.
Many thanks,
Manikandan.
Edited by: Rui Pereira on Dec 23, 2008 3:49 PMDear Manikandan P,
Is there any change and check in stored procedure SBO_SP_TransactionNotification?
Best Regards
Jane Jing
SAP Business One Forums team
Edited by: Rui Pereira on Dec 23, 2008 3:56 PM -
Error while linking user defined table to user defined field using vb6.0
Hi,
I am creating a userdefined field on a SAPB1 table(PDN1) using vb 6.0
I am trying to link this field to a user defined table.
When i do that i get the following error:
"The field 'Related table' should consist of 8 alphanumeric chracters with no valid or default values"
When i try to do the same thing from SAPB1(not using code) there is no such problem.
My vb code is as follows:
Set oUserFieldsMD = oCmp.GetBusinessObject(oUserFields)
oUserFieldsMD.TableName = "PDN1"
oUserFieldsMD.Name = "OB_Locn"
oUserFieldsMD.Description = "WH Location"
oUserFieldsMD.Type = db_Alpha
oUserFieldsMD.EditSize = 30
lRetCode = oUserFieldsMD.Add
If lRetCode <> 0 Then
oCmp.GetLastError lErrCode, sErrMsg
MsgBox sErrMsg
GoTo Err_
End If
If Not oUserFieldsMD.GetByKey("PDN1", 0) Then
MsgBox "Error"
GoTo Err_
End If
oUserFieldsMD.LinkedTable = "OB_TEST"
lRetCode = oUserFieldsMD.Update
Your help will be much appreciated.
Thanks.Great Sébastien!
Looks like we could not survive here one day without your contribution
Best regards,
Frank
PS: For readers of this thread who don't understand why
EditSize
must be "8":
This is the size of the
Code
field in the user-defined table to which the new field OB_Locn (in the DB it will be U_OB_Locn) is linked to...
So, it should be preferrably of the same size. -
User defined field values doesnot show up in summary tab
Hi,
I have created my own stylesheet to display some of my user defined field values (associated with organization address book entry type) in the summary tab of the addressbook entry. But Groupwise 8.0 client FAILS to display any of the user defined field values in the summary tab FOR ONLY ORGANIZATION ADDRESSBOOK ENTRY types. NOTE: These organization addressbook entries are created using the C++ Groupwise object API. But the Advanced tab of these organization addressbook entry shows those user defined fields with values in it.
Also Groupwise 8.0 Client is able to display the user defined field values in the summary tab for the PERSON ADDRESSBOOK ENTRY types, that are created using the Groupwise Object API. Also when I create a Organization addressbook entry using the Groupwise Client (NEW ORGANIZATION) and fill in the user defined field values using the Advanced tab or that addressbook entry, the summary tab displays those user defined field values.
So there could be some problem in setting the user defined field value for the Organization address book entry using the Object API or it could be Groupwise 8.0 Client issue in displaying the user defined field values ONLY FOR ORGANIZATION ADDRESS BOOK ENTRY, WHICH ARE CREATED USING THE OBJECT API. I also tried to see the underlying XML data in the summary tab and that XML data is missing the USERDEFINEDFIELDS and CATEGORIES tag for the organization address book entry.
I would like to know, if there is any need for special handling only for Organization addressbook entry in Groupwise 8.0 API. Any thoughts or help is really appreciated.Hi,
Does anyone have an idea?? Think I have the same issue. Except, when I log in the client (ver. 802) then all the info is displayed. But when the user logs in on the same client and the same pc, he sees the xml info except the office address.
Any help is greatly appreciated!
Grtz,
Joost Brenters
Maybe you are looking for
-
Using Numbers with JAVA Programming
I'm about to fail JAVA and require expert solution to this problem: When you take the year of the birth of Bill Clinton and add to it the year he took office plus his age at his last birthday, and then subtract the number of full years he has been in
-
Nokia e66 doesn't work after failed update!
Yea i was updating firmware and my phone restarted on the Ovi suit seed that it's normal but it didn't turn back on it just flashes the buttons and thats all few seconds later it turns of. Please help my!
-
Oracle query returns every expected record twice
I have a query that at times could return a very large number of records, but I want to process them in blocks within a time budget, so I will process as many as I can within a time budget and then close the ResultSet. I looked at the two obvious way
-
Generate arabic pdf in oracle report 10g
what is the right way to generate arabic language in oracle report 10g destype=PDF?? i do that for font < arial > and < transparent arabic > but i have a problem with some arabic font like < simpilified arabic > and i put this font in utifont.ali
-
I'm using HP AIO PRO400 with Windows 10 TP up from Windows 8.1 After all, the touch screen seem to be disabled. Someone help me.