datatypes

How can I use sp_xml_preparedocument on result of NTEXT query in SQL 2000?

I know NTEXT is going away and that there are larger best-practices issues here (like storing XML in an NTEXT column), but I have a table containing XML from which I need to pluck a attribute value. This should be easy to do using sp_xml_preparedocument but is made more tricky by the fact that you cannot declare a local variable of type ...

What format is the output of HashPasswordForStoringInConfigFile () and how to store it the best?

I'm using this function to generate a hash for a password and then store it in the database (SQL Server). The code looks like this: byte[] saltBytes = new byte[16]; new RNGCryptoServiceProvider ().GetBytes (saltBytes); string salt = Convert.ToBase64String (saltBytes); string saltedPasswordHash = FormsAuthentication.HashPasswordForStori...

how does an objective-c xmlchar data type work

In objective c how does an xmlchar data type work? I can't seem to find any API documentation. Specifically my declaration looks like: const xmlChar **attributes Am I classifying this correctly by saying it's an objective c data type or is it specific to cocoa or just C? ...

Strategy for coping with database identity/autonumber maxing out

Autonumber fields (e.g. "identity" in SQL Server) are a common method for providing a unique key for a database table. However, given that they are quite common, at some point in the future we'll be dealing with the problem where they will start reaching their maximum value. Does anyone know of or have a recommended strategy to avoid t...

Is the CHAR datatype in SQL obsolete? When do you use it?

The title pretty much frames the question. I have not used CHAR in years. Right now, I am reverse-engineering a database that has CHAR all over it, for primary keys, codes, etc. How about a CHAR(30) column? Edit: So the general opinion seems to be that CHAR if perfectly fine for certain things. I, however, think that you can design a da...

Migrating an Access data table to SQL Server 2005

I used the standard import / export tool to bring a table into my SQL database. The dates all came over as CHAR types. Now, I keep getting a conversion error stating the CHAR to datetime resulted in an out of range condition. Help please. ...

How should I pass a user-defined type to SqlParameterCollection.AddWithValue?

I have a custom data type called StudentID, which has an implicit conversion to string. When I pass a StudentID instance to SqlCommand.Parameters.AddWithValue (as the value) and execute the command, I receive the following error: "No mapping exists from object type StudentID to a known managed provider native type." Specifying a type ...

How to implement an unsigned 64-bit int in Java using BigInteger class?

I am looking for one datatype with exact capacity of 0 to 2^64 - 1. We know that Java as it is does not support 'unsigned' barring char datatype. There is BigInteger class that allows creation of larger numbers that long datatype cannot support. But I am not sure how BigInteger class would serve my purpose. BigInteger class allows assi...

Oracle Character Types

Is using a VARCHAR2 (1 BYTE) any less efficient than using CHAR(1 BYTE)? Is using a VARCHAR2 (2000 BYTE) any less efficient than using CHAR(1 BYTE), if I never put any value longer than one character in the field? ** By efficient, I meant efficient in both time (searching) and space (storing). ...

wsdl s:time type not working in c#

I'm sending SOAP requests to an external web service. There are several fields that make up the request and one of them is defined as a s:time type. I would like to set this time field to a value but c# only accepts a datetime type and not just time. ... soapClient soapService = new soapClient(); sendTime soapRequest = new sendTime();...

Problem converting very small doubles to SQL floats

I'm trying to store a C# double in MS SQL 2005 as a float. However, there seem to be a range of small numbers which are valid doubles but which aren't valid floats. For example, when I try to store the value 1e-320 I get the error "the supplied value is not a valid instance of type float". This is consistent with the documentation for S...

High precision integer math in C#?

Hi, I have a very large number I need to calculate, and none of the inbuilt datatypes in C# can handle such a large number. Basicly I want to solve this: Project Euler 16: 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? I have already written the code...

How to read negative byte values in Java less than -128

I'm reading data from another system using the serial port. I'm reading packets of 133 bytes. The second byte is the packet number and the third byte is the negative value of the packet number. The problem is that the type byte has a range of -128 to 127. When I attempt to read -129 (outside the range of byte) it will give the value ...

Why is it important to understand the difference between reference types and primitive types in Java?

I'm after a list of issues in Java that cannot be properly understood without first understanding the difference. For example: Passing parameters to methods Precisely what limitations are imposed by using "final" on a variable declaration. What == means Any more? EDIT: this question doesn't seem to make sense to people. The m...

When should I use double instead of decimal?

I can name three advantages to using double (or float) instead of decimal: Uses less memory Faster because floating point math operations are natively supported by processors Can represent a larger range of numbers But these advantages seem to apply only to calculation intensive operations, such as those found in modeling software. O...

How to reduce size of ms sql table that grew from a datatype change.

I have a table on an MS SQL 2005 server that was about 4gb in size. (about 17 million records) I changed one of the fields from datatype char(30) to char(60). (there are in total 25 fields most of which are char(10) so the amount of char space adds up to about 300) This caused the table to double in size (over 9gb) I then changed t...

Appropriate .Net data type for decimal(20,0)

I've got some sql returning a decimal(20,0) data type. In SSIS I have a package with a foreach loop. In my variable mappings, what type of variable would I map it to? I've tried Int32, Int64, double, and still get the error "The type of the value being assigned to variable "User::iID" differs from the current variable type..." ...

Store time of the day in SQL

How would you store a time or time range in SQL? It won't be a datetime because it will just be let's say 4:30PM (not, January 3rd, 4:30pm). Those would be weekly, or daily meetings. The type of queries that I need are of course be for display, but also later will include complex queries such as avoiding conflicts in schedule. I'd rather...

C Programming Data Types

A question was asked, and I am not sure whether I gave an accurate answer or not. The question was, why use int, why not char, why are they separate? It's all reserved in memory, and bits, why data types have categories? Can anyone shed some light upon it? ...

What type of ID does Youtube use for their videos

I am curious what type of ID that youtube uses for identifying their videos? They seem to be the same type of IDs used for short urls on sites like Digg and Bit.ly. ...