Solved

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

Posted on 2014-03-28
3
352 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 32

Expert Comment

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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

759 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

18 Experts available now in Live!

Get 1:1 Help Now