Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQL SMALLDATETIME Data Type

-- The SMALLDATETIME data type specifies a date and time of day in SQL Server.
-- SMALLDATETIME supports dates from 1900-01-01 through 2079-06-06.
-- The default value is 1900-01-01 00:00:00.
--The seconds are always set to 0, and fractional seconds are not included.

-- EXAMPLE

CREATE TABLE DemoTable  
( 
  Id INT IDENTITY, 
  ProductName VARCHAR(100) NOT NULL,
  RestockDate SMALLDATETIME
);
GO  

INSERT INTO DemoTable VALUES ('Lays Chips', '2021-02-15 9:55:12');
INSERT INTO DemoTable VALUES ('Quaker Oats', '2021/11/08 8AM');
INSERT INTO DemoTable VALUES ('Oreo Cookies', '2021-05-14 13:12');
INSERT INTO DemoTable VALUES ('Fritos', '2021-9-2');
INSERT INTO DemoTable VALUES ('Cheetos', NULL);
GO  

SELECT * FROM DemoTable;
GO

DROP TABLE DemoTable;
GO

Results:  5 records
ID	PRODUCTNAME	RESTOCKDATE
1	Lays Potato Chips	2021-02-15 09:55:00
2	Quaker Oats	2021-11-08 08:00:00
3	Oreo Cookies	2021-05-14 13:12:00
4	Fritos	2021-09-02 00:00:00
5	Cheetos	NULL


-- Notice how SQL Server accepts different input date and time formats.
-- These formats are converted to the internal format which is 'YYYY-MM-DD HH:MM:00'.


Comment

smalldatetime in sql

The SMALLDATETIME data type specifies a date and time of day in SQL Server. SMALLDATETIME supports dates from 1900-01-01 through 2079-06-06. The default value is 1900-01-01 00:00:00. The seconds are always set to 0, and fractional seconds are not included.
Comment

PREVIOUS NEXT
Code Example
Sql :: sql ignore 
Sql :: SQL Addition Operator 
Sql :: sqlalchemy filter by relationship 
Sql :: sql join 3 tables 
Sql :: sql reverse 
Sql :: install sql server in ubuntu 20.04 
Sql :: not in in mongodb 
Sql :: sql not 
Sql :: How to automatically export database to a csv file 
Sql :: how to get capital letter first in sql 
Sql :: mysql update sum same table 
Sql :: mysql error 1452 
Sql :: SQL Add Multiple Columns in a Table 
Sql :: sql double quotes in string 
Sql :: between operator 
Sql :: nested query 
Sql :: postgresql comandos basicos 
Sql :: sql query examples 
Sql :: pl sql revoke role from user 
Sql :: run eroku psql 
Sql :: hou to run job from cmd .exe sql server jop 
Sql :: mysql group by derived column 
Sql :: delete double on SQL with multiple primary keys 
Sql :: homebrew nysql launch 
Sql :: db2 foreign keys 
Sql :: requete sql mise a jour content dans un colone mysql 
Sql :: connect colab with Microsoft sql server 
Sql :: oracle alter database open restricted session 
Sql :: python simple crud application using sqlite 
Sql :: hierachichal sql query 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =