3

I am using SQL SERVER for database related operation in my application.

I have created one view that contains following data:

enter image description here

I want one new field with this view and that field should contains the same data as you can see in Size column in the above view.

But I have to remove coming slash from that data.

Is there any query or function to remove slash from the data in SQL SERVER?

2
  • 1
    Check out replace() Commented Mar 10, 2017 at 6:10
  • @Raj Ohh yes it's running. thanks Raj Commented Mar 10, 2017 at 6:12

3 Answers 3

3

Do it like this in Query:

declare @sam varchar(50);
set @sam= 'this/is/sample';

select replace(@sam,'/','');
Sign up to request clarification or add additional context in comments.

Comments

3

Just select the columns you need from the view, but use REPLACE() on the Size column to remove the forward slash:

SELECT [SizePropId],
       [VendorId],
       [VendorName],
       [ModelId],
       [Model],
       [SizeId],
       REPLACE([Size], '/', ''), AS [Size]
       [ProductCode],
       [CategoryId],
       [LoadIndex_Spec],
       [RunFlate],
       [ListPrice]
FROM yourView

1 Comment

Thank you so much for such help
2

Try to use SQL replace function to replace single character

example:

select Replenter code hereace(ColumnName, '/', '') as NewColumnName,* from  TableName

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.