Click here to Skip to main content
15,886,578 members
Home / Discussions / Database
   

Database

 
GeneralRe: Can we restrict the number of maximum records inserted in a particular table? Pin
Mycroft Holmes21-Jul-08 19:55
professionalMycroft Holmes21-Jul-08 19:55 
GeneralRe: Can we restrict the number of maximum records inserted in a particular table? Pin
Rocky#21-Jul-08 21:07
Rocky#21-Jul-08 21:07 
AnswerRe: Can we restrict the number of maximum records inserted in a particular table? Pin
nelsonpaixao24-Jul-08 12:34
nelsonpaixao24-Jul-08 12:34 
QuestionConvert Decimal To Date? Pin
obarahmeh20-Jul-08 23:06
obarahmeh20-Jul-08 23:06 
AnswerRe: Convert Decimal To Date? Pin
Rocky#21-Jul-08 0:20
Rocky#21-Jul-08 0:20 
GeneralRe: Convert Decimal To Date? [modified] Pin
Pete O'Hanlon22-Jul-08 9:19
mvePete O'Hanlon22-Jul-08 9:19 
GeneralRe: Convert Decimal To Date? Pin
Rocky#22-Jul-08 18:24
Rocky#22-Jul-08 18:24 
GeneralRe: Convert Decimal To Date? [modified] Pin
Pete O'Hanlon22-Jul-08 22:06
mvePete O'Hanlon22-Jul-08 22:06 
No, no, no. You're just plain wrong.

GETDATE() is a system function, not field data. It's no different in effect to you typing SELECT 3. This doesn't mean that every integer field defaults to 3. Tell you what, as a test, run the following script:
USE [<<database>>]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].Test(
	[ID] [int] IDENTITY(1,1) NOT NULL,
    [Text] NVARCHAR(20) NOT NULL,
	[Created] [datetime] NOT NULL,
 CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, 
STATISTICS_NORECOMPUTE  = OFF, 
IGNORE_DUP_KEY = OFF, 
ALLOW_ROW_LOCKS  = ON, 
ALLOW_PAGE_LOCKS  = ON) 
ON [PRIMARY]
) 
GO

INSERT INTO Test([Text])  VALUES ('Hello')

GO
Guess what. Created doesn't get a default value. What you do get is an error:

Msg 515, Level 16, State 2, Line 2
Cannot insert the value NULL into column 'Created', table 'database.dbo.Test'; column does not allow nulls. INSERT fails.
The statement has been terminated.

So no default value there then. Please, before you pass information like this along, will you please check to see if you are right?


[EDIT]Rocky# is right - we are talking at cross purposes here, and he's entirely right to say that there is no date only type in SQL Servers up to 2005. 2K8 has a date type which stores the date only, but datetime does what it says on the tin and has the time portion as part of it.

My apologies for any confusion caused by my misreading of Rocky#'s post.[/EDIT]

Deja View - the feeling that you've seen this post before.

My blog | My articles



modified on Wednesday, July 23, 2008 7:12 AM

GeneralRe: Convert Decimal To Date? Pin
Rocky#22-Jul-08 23:20
Rocky#22-Jul-08 23:20 
GeneralRe: Convert Decimal To Date? Pin
Pete O'Hanlon23-Jul-08 1:08
mvePete O'Hanlon23-Jul-08 1:08 
GeneralRe: Convert Decimal To Date? Pin
Rocky#23-Jul-08 3:02
Rocky#23-Jul-08 3:02 
AnswerRe: Convert Decimal To Date? Pin
Blue_Boy21-Jul-08 0:36
Blue_Boy21-Jul-08 0:36 
AnswerRe: Convert Decimal To Date? Pin
zahedonline21-Jul-08 0:37
zahedonline21-Jul-08 0:37 
AnswerRe: Convert Decimal To Date? Pin
leoinfo21-Jul-08 2:37
leoinfo21-Jul-08 2:37 
GeneralRe: Convert Decimal To Date? Pin
obarahmeh21-Jul-08 21:54
obarahmeh21-Jul-08 21:54 
GeneralRe: Convert Decimal To Date? Pin
Mycroft Holmes21-Jul-08 23:52
professionalMycroft Holmes21-Jul-08 23:52 
QuestionFile size Pin
rezarafiee20-Jul-08 19:01
rezarafiee20-Jul-08 19:01 
AnswerRe: File size Pin
Krish - KP20-Jul-08 20:58
Krish - KP20-Jul-08 20:58 
AnswerRe: File size Pin
Ashfield20-Jul-08 21:00
Ashfield20-Jul-08 21:00 
QuestionNortwind database selection through database expert ??? Pin
amistry_petlad20-Jul-08 8:30
amistry_petlad20-Jul-08 8:30 
AnswerRe: Nortwind database selection through database expert ??? Pin
Paul Conrad20-Jul-08 9:51
professionalPaul Conrad20-Jul-08 9:51 
GeneralRe: Nortwind database selection through database expert ??? [modified] Pin
amistry_petlad20-Jul-08 13:06
amistry_petlad20-Jul-08 13:06 
GeneralRe: Nortwind database selection through database expert ??? Pin
Paddy Boyd21-Jul-08 2:30
Paddy Boyd21-Jul-08 2:30 
GeneralRe: Nortwind database selection through database expert ??? Pin
Paul Conrad21-Jul-08 6:13
professionalPaul Conrad21-Jul-08 6:13 
QuestionProblem in a query Pin
Shuaib wasif khan19-Jul-08 23:18
Shuaib wasif khan19-Jul-08 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.