user-defined-data-type

How to define a user-defined data type with addressable members?

I have an unusual situation to model in a MS SQL Server database: the primary key of a table is a multi-segment 'natural' key composed of 5 foreign keys (of fixed sizes). I'd like to be able to define a user-defined data type to implement the data structure based on a CHAR(8) primitive in such a way that the elements are addressable as ...

is creating db user defined data types best practice?

Is creating user defined types instead of using existing types best practice? In my previews work place all basic types were predefined, is it best practice? what advantages and what disadvantage it has.Thanks a lot! ...

Are user-defined SQL datatypes used much?

My DBA told me to use a user-defined SQL datatype to represent addresses, and then use a single column of that new type in our users table instead of multiple address columns. I've never done this before and am wondering if this is a common approach. Also, what's the best place to get information about this - is it product-specific? ...

SQL Server 2008: Can a multi-statement UDF return a UDT?

Is it possible that a multi-statement UDF return a User Defined Table Type, instead of a table that is defined within it's return param? So instead of: CREATE FUNCTION MyFunc ( @p1 int, @p2 char ) RETURNS @SomeVar TABLE ( c1 int ) AS I would like to do: CREATE FUNCTION MyFunc ( @p1 int, @p2 char ) RETURNS @SomeVar M...

C++ min heap with user-defined type.

Hi, I am trying to implement a min heap in c++ for a struct type that I created. I created a vector of the type, but it crashed when I used make_heap on it, which is understandable because it doesn't know how to compare the items in the heap. How do I create a min-heap (that is, the top element is always the smallest one in the heap) fo...

How to use a data type (table) defined in another database in SQL2k8?

I have a Table Type defined in a database. It is used as a table-valued parameter in a stored procedure. I would like to call this procedure from another database, and in order to pass the parameter, I need to reference this defined type. But when I do DECLARE @table dbOtherDatabase.dbo.TypeName , it tells me that The type name 'dbOther...

Using a user defined type

Hello guys, I'm defining a a type to represent a board of my game: type Position = (int * Piece) list But when I create a list like this: let board1 = [(1,Piece.BLACK);(2,Piece.WHITE);(3,Piece.BLACK);(4,Piece.WHITE); ...] I create a list of (int * Piece) list, not a Position. How can I change this? Which is the...

c++ convert class to boolean

With all of the fundamental types of C++, one can simply query: if(varname) and the type is converted to a boolean for evaluation. Is there any way to replicate this functionality in a user-defined class? One of my classes is identified by an integer, although it has a number of other members, and I'd like to be able to check if the i...

Managing user-defined types across various modules

What is the best way to manage common user-defined types across VBA modules? I use the same user-defined types in different modules. For example, I often need to represent (x,y) points, so I end up having this Type in different modules: Type XYpointType x As Double y As Double End Type I pass arguments of type XYpointType to...