New answers tagged

1

This is all IMHO: •table entry created and updated: date or timestamp? Why? With date isnt it easier to display and sort on the frontend? Use a timestamp - better for multiple mods in a given day. •Entry title - VARCHAR or text? You're not going to lose much with a text over VARCHAR, but I think that VARCHAR is the reasonable choice. •Entry body - I ...


4

It is truncating because the replacement_value parameter is being converted to the same data type as the check_expression. From https://msdn.microsoft.com/en-us/library/ms184325.aspx ISNULL ( check_expression , replacement_value ) replacement_value must be of a type that is implicitly convertible to the type of check_expresssion. Return Types ...


-1

Another option is to use 4 INTEGER or 2 BIGINT columns.


3

The output from the CASE can only be of one data type. The first branch is decimal and the second is nvarchar(255). According to the Data Type Precedence (Transact-SQL) rules in SQL Server the resulting data type for the CASE is decimal. Add one more cast to nvarchar(255) in the first branch of the CASE. SELECT CASE WHEN [Parcel Number 1] like '%E+%' ...


0

SQL Server has a feature called wide tables which will let you go up to 30,000 columns per table. It uses sparse columns and column sets. Create Table dbo.Example ([Id] Int Identity(1, 1), [Value1] Int Sparse, [Value2] Int Sparse, Cs Xml Column_Set For All_Sparse_Columns) You define all the extra data columns as Sparse (this would normally indicate most ...


0

From the manual here, you can simply use the DATE() function. DATE(expr) Extracts the date part of the date or datetime expression expr. mysql> SELECT DATE('2003-12-31 01:02:03'); -> '2003-12-31' It is designed for precisely your use case. Although the quote is from the 5.7 manual, it works right back to at least 5.0. You don't have to ...



Top 50 recent answers are included