none
remove quote RRS feed

  • Question

  • inmy table i have field like this

    "2345"

    "34545"

    how to remove it " "

    i just want 2345 ,not quote around it

    Tuesday, November 13, 2012 9:02 PM

Answers

All replies

  • Try

    update myTable SET MyField = replace(MyField, '"','')


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Tuesday, November 13, 2012 9:06 PM
    Moderator
  • create table table1(field1 varchar(100));

    insert table1 values('"2345"');

    select replace(field1, '"','') from table1;



    Pollus

    Tuesday, November 13, 2012 9:09 PM
  • how to use this in derived column
    Tuesday, November 13, 2012 9:36 PM
  • Can you post your table definition? Basically, you should add REPLACE function around your derived column definition.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Tuesday, November 13, 2012 9:37 PM
    Moderator
  • how to use this in derived column

    Why not state your problem from start to end directly?

    CREATE TABLE tbl (...
                      myunquotedcol AS replace(quotedcol, '"', ''),
                      ...)

    If it was a computed column in a table that you meant.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, November 13, 2012 9:41 PM
  • Hi tsql_new,

    As Naomi suggested, we can use REPLACE (Transact-SQL) command, do you want to remove the quotes from the result rather than the original table? Please check whether the following result is what you wanted.

    create table QuoteRemove
    (
    	ID int identity (1,1),
    	Value varchar(100)
    )
    
    insert into QuoteRemove values ('"a"');
    
    select * from QuoteRemove;
    select REPLACE(Value,'"','') Value from QuoteRemove;
    

    For more detail information, please refer to the following link:

    REPLACE (Transact-SQL):
    http://msdn.microsoft.com/en-us/library/ms186862.aspx



    Allen Li

    TechNet Community Support

    Wednesday, November 14, 2012 9:54 AM
    Moderator
  • Do u mean Derived column Transformation in SSIS


    Please have look on the comment

    Wednesday, November 14, 2012 10:08 AM
  • you can do it like this :-

    declare @a varchar(10)
    set @a = '"rohit"'
    select @a, replace(@a,'"','')


    Regards,
    Rohit Garg
    (My Blog)
    This posting is provided with no warranties and confers no rights.
    Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread.

    Wednesday, November 14, 2012 11:27 AM