[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

SQL Text Field and Constraints

Hi,

I am trying to put a length constraint on a field of type text however, SQL Management Studio is giving me an error when attempting to do this. Can you explain why and suggest a solution/ alternative.

Thanks
(len([Note])>0)

Open in new window

0
dfincham28
Asked:
dfincham28
  • 2
  • 2
2 Solutions
 
bmatumburaCommented:
Why not specify a NOT NULL attribute on the field's properties?
0
 
bmatumburaCommented:
See attached screen shot:
123.JPG
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
for TEXT, you have to use data_length:
(data_length([Note])>0)

Open in new window

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
note: in sql 2005 and higher, replace TEXT by VARCHAR(MAX) and you will have less problems.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now