读书人

SQL插入数据时加下‘’号

发布时间: 2012-09-06 10:37:01 作者: rapoo

求助:SQL插入数据时加上‘’号
现有数据 01 02 03 。。。。
需要插入另一数据库中为 ‘01’,‘02’,'03' .... 需哟如何处理
或是插入后批量能更新也可,谢谢

[解决办法]

SQL code
insert into tb(col) select '''01'''
[解决办法]
SQL code
select '''name1'''--1select ''name1''  --2select 'name1'    --3
[解决办法]
SQL code
-- 更新update tb set col1= ''''+ col1 + '''';
[解决办法]
insert table B(field) select '''' + fieldname + '''' from table A
[解决办法]
4楼的 应该满足你的要求


[解决办法]
仅供参考:
SQL code
CREATE TABLE t1(    id VARCHAR(5))DECLARE @str VARCHAR(2000)='01 02 03'SET @str=REPLACE(@str,' ',''''''' union all select ''''''')SET @str='insert into t1 select '''''''+@str+''''''''PRINT @strEXEC (@str)SELECT * FROM t1---------------id'01''02''03' 

读书人网 >SQL Server

热点推荐