473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Need help with creating a query to run in enterprise manager

Any help with this would be greatly appreciated. I need to create a query and my SQL skills are very very rusty.

Lets say I have the following;
Database name = users
Table name = info1
Table type is NVARCHAR 40
Info1 can contain the following type of data;
<NULL>, all numbers ie.. 1111222233334444, or alphanumeric ie.. JAMISON/ JOHN8

Here is my challenge. I need an update query to go through every record and if it is of type "all numbers" ie.. 1111222233334444, I want to keep the last 4 numbers and replace the rest with 0. So the resulting record would be 0000000000004444.

Can one of you SQL genius's help me with this. I'm stumped.
Mar 14 '08 #1
3 1177
Delerna
1,134 Expert 1GB
Try checking the SQL help files index for the function ISNUMERIC
That should get you started.
Mar 17 '08 #2
Try checking the SQL help files index for the function ISNUMERIC
That should get you started.
'Any other help? I REAlly am rusty and neeed a lot of help. THANKS!
Mar 26 '08 #3
ck9663
2,878 Expert 2GB
Any help with this would be greatly appreciated. I need to create a query and my SQL skills are very very rusty.

Lets say I have the following;
Database name = users
Table name = info1
Table type is NVARCHAR 40
Info1 can contain the following type of data;
<NULL>, all numbers ie.. 1111222233334444, or alphanumeric ie.. JAMISON/ JOHN8

Here is my challenge. I need an update query to go through every record and if it is of type "all numbers" ie.. 1111222233334444, I want to keep the last 4 numbers and replace the rest with 0. So the resulting record would be 0000000000004444.

Can one of you SQL genius's help me with this. I'm stumped.
try:

Expand|Select|Wrap|Line Numbers
  1. update info1
  2. set YourColumn = right(replicate('0',16) + right(YourColumn,4),16)
  3. where isnumeric(YourColumn) = 1
  4.  
Just replace the column name.

-- CK
Mar 26 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: RJMAL | last post by:
Recently we upgraded our server from SQL 7.0 to SQL 2000. I created a new view in Enterprise Manager which pulls data from a linked server's database. When I write the view... CREATE VIEW...
1
by: ffoiii | last post by:
I am attempting to connect to a remote default instance of SQL Server 2k on Win2k using Enterprise Manager from my local host but receive a "SQL Server registration failed, timeout expired" error...
1
by: Greg Doherty | last post by:
I am using SQL Server 2000. I have created a new database in Query Analyzer but I cannot see it in Enterprise Manager. I then created a new database in Enterprise Manager, but I can't see it in...
2
by: jcabc | last post by:
The row counts I am getting from SQL Enterprise Manager and Query Analyzer are different. When I double click a table in Enterprise Manager it gives me a row count of say 1000. However, when I...
3
by: Matt | last post by:
If I open Enterprise Manager through a saved MSC file, the Tools > SQL Query Analyzer option is greyed out (unavailable). If I open Enterprise Manager from the Programs menu, Query Analyzer is...
13
by: Mike | last post by:
Normally scheduling a job is a very elementary operation but for some hidden reason I've been unable to schedule a job which runs on a 28 day cycle, even though I have at least 16 other jobs...
6
by: Jon Vitar | last post by:
Can anyone suggest a reliable hosting provider? Our current provider has been experiencing a lot of down time lately. I'm looking for an ASP.NET hosting provider that: 1. allows remote SQL...
4
by: Anns via SQLMonster.com | last post by:
My company currently has about 20-25 Ms Access Database that they want to replace the FE with .net and the BE on SQL. This will be done using Visual Studio 2005. Once the FE is converted to...
1
by: chudson007 | last post by:
Hi All, What are the pros and cons between using Enterprise Manager or Query Analyzer for my queries. Currently I use Enterprise Manager because I prefer the interface and only use Query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.