Solved

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

Posted on 2014-03-28
3
364 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 143

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

839 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