Purchase Solution

Update statement

Not what you're looking for?

Ask Custom Question

Here is the issue, a table namedPoints varchar(81) has values stored in a column named Point. There are two columns in the Points table, X and Y. Here is the code that created the table:
REATE TABLE dbo.POINTS (
I INT IDENTITY NOT NULL
,Point varchar(81) NOT NULL
,X decimal(38,10) NULL
,Y decimal(38,10) NULL
)
GO
INSERT dbo.POINTS (Point) VALUES ('(45.123,22.5)')
INSERT dbo.POINTS (Point) VALUES ('(7.95,3.45)')
INSERT dbo.POINTS (Point) VALUES ('(100.2,15.498)')
GO

I need a query using an UPDATE statement to populate X and Y from Point. THe data on the left side of the comma is X and on the right side of the comma is Y. I am guessing that either Substring or Charindex would beused but I am not sure.

Purchase this Solution

Solution Summary

An update statement is created to populate two columns with decimal values based on POINT table.

Solution Preview

UPDATE points
SET
x = CAST(SUBSTRING(point,2,CHARINDEX(',',point)-2) AS ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.