Solved

SQL Text Field and Constraints

Posted on 2009-04-02
4
309 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
ID: 24048147
Why not specify a NOT NULL attribute on the field's properties?
0
 
LVL 11

Expert Comment

by:bmatumbura
ID: 24048171
See attached screen shot:
123.JPG
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24048302
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
ID: 24048305
note: in sql 2005 and higher, replace TEXT by VARCHAR(MAX) and you will have less problems.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to PARSE a text field that is delimited by '~' character? 3 61
SQl server restarts itself 6 37
Compare data between two databases 16 103
Analysis of table use 7 47
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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