Connecting Tech Pros Worldwide Help | Site Map

sql create tables

Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#1: Aug 28 '09
Hi, I am just trying to set a sql database. I have this to create a table. I need to know two things.
1. I want the table to allow null. Anyone could tell me how I modify the null part. Is it just
AS NULL.
2. the other is as I am moving from an access database where I changed some fields from text to memo.
Is the [nvarchar] (25) part of that, and instead of declaring type of field you just declare its size, ie. (25) or (225) ?

Quote:
[PDCustom14] [nvarchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
Thanks for any help.
Richard
MrMancunian's Avatar
Expert
 
Join Date: Jul 2008
Location: Utrecht, The Netherlands
Posts: 274
#2: Aug 28 '09

re: sql create tables


Hi Richard,

If you want a column to allow null, don't do anything. If you don't want to accept null, use Not Null.

Nvarchar is a char with a maximum length of 255 characters. You use it as you said, use the parentheses to state the number of characters you want to use. If you want to use more than 255 character, you can use ntext.

Steven
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#3: Aug 28 '09

re: sql create tables


Thank Stephen, really helpful.

I do have a doubt though I have
Expand|Select|Wrap|Line Numbers
  1. [PDPhoto] [image] NULL 
,

This null isnt, not null, but does it mean the same thing?
and the other thing I have read that [nvarchar] (max)
allows as much data as you want?
Thanks
Richard
Reply