这是我的存储过程:
iFrameElement = Driver.FindElementByTagName("iFrame");
driver = Driver.SwitchTo().Frame(this.iFrameElement);
driver.FindElement(selector);
我在2个不同的主机中有2个表,本地是TINH,第二个是SQL_HOME.QLXNK.dbo.TINH
执行时
<div style="width: 576px;border: 1px solid black;margin: 25px;padding: 25px;text-align: center;height: 393px;transform: rotate(90deg);float:left;clear: left;">
<br><br><br><br><br><br><br><br>
<div>
<h5>TEST</h5></div><br>
<span>1/2</span>
</div>
<div style="width: 576px;border: 1px solid black;margin: 25px;padding: 25px;text-align: center;height: 393px;transform: rotate(90deg);float:left;clear: left;">
<br><br><br><br><br><br><br><br>
<div>
<h5>TEST</h5></div><br>
<span>2/2</span>
</div>
我收到错误:
字符串或二进制文件将被截断
但只是正常插入 - &gt;它有效!
CREATE PROC InsertTINH
@MaTinh char(4),
@TenTinh varchar(50),
@MaNuoc char(2)
as
begin
if exists (select * from TINH where MaTinh = @MaTinh)
begin
print 'Ma Tinh already exists'
return
end
else
begin
if not exists (select * from NUOC where MaNuoc = @MaNuoc)
begin
print 'Ma nuoc does not exist'
return
end
else
begin
insert into TINH
values ('@MaTinh', '@TenTinh')
insert into SQL_HOME.QLXNK.dbo.TINH
values ('@MaTinh', '@MaNuoc')
print 'Inserted successfully ' + @TenTinh
end
end
end
GO
我的存储过程有什么问题?
答案 0 :(得分:3)
您需要删除变量/参数周围的'
:
insert into TINH values (@MaTinh,@TenTinh)
insert into SQL_HOME.QLXNK.dbo.TINH values (@MaTinh,@MaNuoc)
@MaTinh
- 变量,'@MaTinh'
- 字符串
DECLARE @MaTinh char(4) = 'VN01';
SELECT @MaTinh, '@MaTinh';
的 LiveDemo
强>
最好在INSERT
列表中指定列名:
INSERT INTO TINH(col_name1, col_name2) VALUES (@MaTinh,@TenTinh);