Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server SQL server中使用REPLACE语句时出现SQL错误_Sql Server_Session_Replace - Fatal编程技术网

Sql server SQL server中使用REPLACE语句时出现SQL错误

Sql server SQL server中使用REPLACE语句时出现SQL错误,sql-server,session,replace,Sql Server,Session,Replace,我有以下疑问: REPLACE sessions (session_id,session_data,expires) VALUES('pcal586o43604g0vpu5j22', 'id|i:111;user|N;s:9:\\\"admin\\\";admin_page|s:16:\"/control/\";', 1317934461) 这在mysql上运行良好,但在使用SQL SERVER时会抛出以下错误: Msg 102,15级,状态1,第1行“会话id”附近语法不正确 有人能告诉我

我有以下疑问:

REPLACE sessions (session_id,session_data,expires) VALUES('pcal586o43604g0vpu5j22', 'id|i:111;user|N;s:9:\\\"admin\\\";admin_page|s:16:\"/control/\";', 1317934461) 
这在mysql上运行良好,但在使用SQL SERVER时会抛出以下错误:

Msg 102,15级,状态1,第1行“会话id”附近语法不正确

有人能告诉我这个查询有什么问题吗?

在TSQL中,它是一个字符串函数,而不是基于集合的操作

在MySQL中,是SQL标准的MySQL扩展。它要么插入,要么删除并插入。

在TSQL中,是一个字符串函数,而不是基于集合的操作


在MySQL中,是SQL标准的MySQL扩展。它可以插入,也可以删除并插入。

在SQL Server中没有用于替换表中值的命令
REPLACE
。。。。您需要改用标准SQL UPDATE语句:

UPDATE dbo.sessions 
SET session_id = 'pcal586o43604g0vpu5j22',
      session_data = 'id|i:111;user|N;s:9:\\\"admin\\\";admin_page|s:16:\"/control/\";',
      expires = 1317934461
WHERE .... (some condition here - otherwise you update ALL rows!)

T-SQL的
REPLACE
函数是一个字符串函数,用于将另一个字符串中的给定子字符串替换为替换项。

SQL Server中没有用于替换表中值的命令
REPLACE
。。。。您需要改用标准SQL UPDATE语句:

UPDATE dbo.sessions 
SET session_id = 'pcal586o43604g0vpu5j22',
      session_data = 'id|i:111;user|N;s:9:\\\"admin\\\";admin_page|s:16:\"/control/\";',
      expires = 1317934461
WHERE .... (some condition here - otherwise you update ALL rows!)

T-SQL的
REPLACE
函数是一个字符串函数,用于用替换项替换另一个字符串中的给定子字符串。

SQL Server与MySQL没有等价物。您必须手动编写功能代码。

SQL Server与MySQL没有等价物。您必须手动编写该功能。

我必须查找该功能是否已经存在,然后根据该功能进行更新或插入。是这样做的吗?我需要查找它是否已经存在,然后根据此更新或插入。这样做吗?