Reputation: 1409
I am using SQL SERVER for database related operation in my application.
I have created one view that contains following data:
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?
Upvotes: 3
Views: 6801
Reputation: 270
Try to use SQL replace function to replace single character
example:
select Replenter code hereace(ColumnName, '/', '') as NewColumnName,* from TableName
Upvotes: 2
Reputation: 521534
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
Upvotes: 3
Reputation: 4191
Do it like this in Query:
declare @sam varchar(50);
set @sam= 'this/is/sample';
select replace(@sam,'/','');
Upvotes: 3