-3

I found a list of the datatypes for SQL DB (formerly Azure DB) here:

http://msdn.microsoft.com/en-us/library/windowsazure/ee336233.aspx

...but nothing on what exactly each data type is. For example, I need to know:

Since there is no Boolean type, what should I use in lieu of bool in SQL DB?

What is the difference between *datetime* and *datetime2* in SQL DB?

What is the difference between *datetime* (and *datetime2*) and *timestamp* in SQL DB?

What is the *sysname* datatype in SQL DB?
astaykov
  • 30,768
  • 3
  • 70
  • 86
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

1 Answers1

1

All your questions are SQL Server questions, which answers have no difference between Azure and non-Azure.

There is no BOOLEAN type in any version of SQL Server. There is "BIT" data type, which maps to a .NET BOOL data type.

DateTime2 is more precise (up to 1/100000 of a second) then DateTime (1/100 of a second) data type in SQL Server (respectively Windows Azure SQL Database).

DateTime/DateTime2 are SQL Server data types that map to a DateTime .NET type, whilst timestamp is an automatically generated sequence of numbers which is auto incremented on every row update and is used for row versioning and concurrency management in SQL Server / Data aware applications

What is sysname - What is SYSNAME data type in SQL Server?

Please try harder the internet search engines, before asking questions here. And please ask concrete questions!

As already marked by other users - there is nothing AZURE in your questions.

Community
  • 1
  • 1
astaykov
  • 30,768
  • 3
  • 70
  • 86
  • Based on this info, I tried to update a table in my Azure SQL DB portal, changing a column from char[1] with a default value of 'F' to a bit column. But it wouldn't allow me to do it, saying, "An error was encountered while applying the changes. An exception occurred while executing the Transact-SQL statement: ALTER TABLE [dbo].[DUCKBILLEDPLATYPUS_PERMISSIONS] DROP COLUMN [AllowAccess]. The object 'ColumnDefault_21d83918-0ce9-4c2d-bb8d-957107c80c63' is dependent on column 'AllowAccess'. ALTER TABLE DROP COLUMN AllowAccess failed because one or more objects access this column." – B. Clay Shannon-B. Crow Raven Nov 16 '12 at 17:29
  • So based on your comments, any timestamp column I add will be automatically populated? I don't have to specify it as such, the data type itself makes it do that inherently and unerrantly? – B. Clay Shannon-B. Crow Raven Nov 16 '12 at 17:31
  • second comment - YES. First comment - I would be surprised if you could change a CHAR(1) column to A BIT column. BIT column represents a BIT (i.e. 0 or 1). There is no mechanism in SQL Server to map 'F' to 1, or char to number. You could possibly successfully alter an INT column to a BIGINT or FLOAT. But a CHAR to BIT - this won't happen. – astaykov Nov 16 '12 at 19:58
  • Yes, I know that an 'F' wouldn't be valid for a Bit. I guess I wasn't clear; I was trying to change the Char[1] column with a default value of 'F' to a Bit column with a default value of 0. Since there is no data in the table yet, I don't see why I can't change its data type. It wouldn't even allow me to delete the first column and then add it back (so to speak) as a different data type. – B. Clay Shannon-B. Crow Raven Nov 17 '12 at 05:59