Solved

script to check length of values - set to NULL if not correct

Posted on 2014-03-28
3
358 Views
Last Modified: 2014-04-07
Hi

I need to cycle through each row in a table "aspnet_Membership"
And check if the "COMMENT" value is 4 digits long (or NULL)
If they are less than or greater than 4 digits long i need to set them to NULL

The highlghted example is over 4 digits so i need to set to NULL
null digits
can anyone help with the SQL please
0
Comment
Question by:websss
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 39961150
update aspnet_Membership
  set comment = null
where len(COMMENT) > 4
0
 
LVL 5

Expert Comment

by:jayakrishnabh
ID: 39961153
update aspnet_Membership
set Comment=null
where len(ISNULL(Comment,''))<>4
0
 
LVL 33

Expert Comment

by:ste5an
ID: 39961200
Sounds like your misusing the comment column..
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

912 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

22 Experts available now in Live!

Get 1:1 Help Now