Tagged Questions
1
vote
1answer
210 views
How can I restore the sql_variant_property of baseType back to a table variable in SQL Server
Ok, I know the title is confusing but here it goes. BTW I am using SQL Server 2008
I have a table that I am trying to use as a storage container. It has 3 columns:
reportID integer,
dataLabel ...
1
vote
1answer
934 views
Table schema column data type equivalents for Netezza 6 to SQL Server 2008
I'm trying to find a data type equivalents for data types in Netezza when migrating table schema to SQL Server. Where can I find a complete list? When getting down to brass tacks, I am specifically ...
0
votes
4answers
197 views
Writing SQL statement in sqlcmd to hide the milliseconds for column type of time
I have a table called testtable that have a column named expire_time of type [time]
The problem is that when I type the following in sqlcmd:
select * from testtable
It will return the following:
...
0
votes
1answer
217 views
timeout on updating nvarchar(max) after converting datatype
I recently Upgraded to 2008 Enterprise and took the opportunity to change the biggest table in my db with the maintenance window.
ran the following to change my ntext field
ALTER TABLE ...
3
votes
2answers
299 views
Change column data type across database
I have a bunch of tables with many columns of data type ntext. I wish to change all such columns in all tables of a particular database to nvarchar(max), because of planned deprecation (EDIT: also ...
6
votes
2answers
305 views
What are the pros/cons of splitting date and time into separate fields vs. using the datetime data type and storing the date in a single field?
My database is extremely large and growing at a rate of ~20m rows/day. I have timestamp data that is important but most of the reporting is based on date ranges and week over week or month over month ...
7
votes
1answer
270 views
Why does 10^37 / 1 throw an arithmetic overflow error?
Continuing my recent trend of playing with large numbers, I recently boiled an error I was running into down to the following code:
DECLARE @big_number DECIMAL(38,0) = '1' + REPLICATE(0, 37);
PRINT ...
2
votes
1answer
64 views
Create a Function in sql server without specifying return_data_type
I am trying to create a Scalar-valued function in SQL server, without specifying the return_data_type
i want to be able to return any datatype based on a parameter sent by the function caller
e.g.
...
5
votes
2answers
967 views
Data type for storing an array of flags (a bitmap/bit array)
I need to store a bit array for each record of a table, supporting the following operations:
Testing if a bit is set, and setting a bit (using SQL)
Querying and setting the value using ADO 2.8 (not ...
2
votes
4answers
734 views
Best pratice to store dates group by months-year key par value
I am making one service which needs to hold data grouped and calculated by year-month combination. I know how to calculate data and put it on new table. But I am confused what kind of data type I ...
2
votes
1answer
3k views
Table-Valued Parameter as Output parameter for stored procedure
Is it possibile to Table-Valued parameter be used as output param for stored procedure ?
Here is, what I want to do in code
/*First I create MY type */
CREATE TYPE typ_test AS TABLE
(
id int ...
3
votes
1answer
994 views
Storing XML in varchar(MAX) or use SQL-XML
I am defining a schema for a new set of resources using SQL Server 2008... In this case, each record (e.g. row) will need to store XML fragments. From time-to-time; although not frequently; I'll need ...
1
vote
1answer
2k views
Column size with datatype decimal
According to BOL for SQL Server 2008 R2 the data type decimal requires the following
storage bytes:
Precision Storage bytes
1 - 9 => 5
10-19 => 9
20-28 => 13
29-38 ...
7
votes
2answers
1k views
Why does “SELECT POWER(10.0, 38.0);” throw an arithmetic overflow error?
I'm updating my IDENTITY overflow check script to account for DECIMAL and NUMERIC IDENTITY columns.
As part of the check I compute the size of the data type's range for every IDENTITY column; I use ...
17
votes
7answers
5k views
How do long columns impact performance and disk usage?
In our current project it just happens too often, that we need to extend columns by a couple of characters. From varchar(20) to varchar(30) and so on.
In reality, how much does it really matter? How ...
