Solved

SQL Text Field and Constraints

Posted on 2009-04-02
4
287 Views
Last Modified: 2012-05-06
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
Comment
Question by:dfincham28
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:bmatumbura
Comment Utility
Why not specify a NOT NULL attribute on the field's properties?
0
 
LVL 11

Expert Comment

by:bmatumbura
Comment Utility
See attached screen shot:
123.JPG
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
for TEXT, you have to use data_length:
(data_length([Note])>0)

Open in new window

0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
note: in sql 2005 and higher, replace TEXT by VARCHAR(MAX) and you will have less problems.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now