Many people would probably think this question is stupid, but how can i insert a value that starts with 0 in a Bigint/Numeric/Int field?

This would normally not be a problem, just using a varchar field instead, but because of the index speed (this is a very large table with many lookups), I would like to keep it as a numeric field.

Is it in any way, with some settings possible to change the default behaviour of the field in this table?

Recommended Answers

All 2 Replies

Storing a variable length of leading zeros would mean the numeric types (int, etc.) would have to be larger than they, so that's why I think SQL Server doesn't use them internally.

I don't think you can do this. Displaying leading zeros is usually done on the UI's application code, or casting the numeric data type to varchar and appending zeros in the SELECT statement.

I'd be curious to know if there was a possibility.

I don't think you can do this.

I can't understand why your indexing hampered?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.