我有以下触发器:
CREATE Trigger enroll_limit on Enrollments
Instead of Insert
As
Declare @Count int
Declare @Capacity int
Select @Count = COUNT(*) From Enrollments
Select @Capacity = Capacity From CourseSections
If @Count < @Capacity
Begin
Insert Into Enrollments Select * From Inserted
End
GO
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息说:
'CREATE TRIGGER'必须是查询批处理中的第一个语句.
我尝试将文本文件导入数据库时收到转换错误.以下是我收到的错误消息:
第1行第4列(年)的批量加载数据转换错误(类型不匹配或指定代码页的无效字符).
这是我的查询代码:
CREATE TABLE Students
(
StudentNo Integer NOT NULL Primary Key,
FirstName VARCHAR(40) NOT NULL,
LastName VARCHAR(40) NOT NULL,
Year Integer,
GPA Float NULL
);
Run Code Online (Sandbox Code Playgroud)
以下是来自文本文件的示例数据:
100,Christoph,Van Gerwen,2011
101,Anar,Cooke,2011
102,Douglis,Rudinow,2008
Run Code Online (Sandbox Code Playgroud)
我想我知道问题是什么..下面是我的批量插入代码:
use xta9354
bulk insert xta9354.dbo.Students
from 'd:\userdata\xta9_Students.txt'
with (fieldterminator = ',',rowterminator = '\n')
Run Code Online (Sandbox Code Playgroud)
对于样本数据,在Year属性之后没有',',即使在年之后还有另一个属性Grade,它是NULL
有人可以告诉我如何解决这个问题吗?
当我尝试导入org.apache.xml.serialize.XMLSerializer时,我得到以下错误消息:
The import org.apache.xml.serialize.XMLSerializer cannot be resolved
Run Code Online (Sandbox Code Playgroud)
谁能告诉我原因?谢谢!!
我有以下触发器:
CREATE Trigger instructor_expertise on CourseSections
After Insert
As Begin
......
If (Not Exists(Select AreaName From AreasOfInstructor Where (InstructorNo = @InstructorNo AND AreaName = @AreaName)))
Begin
RAISERROR('Course not in instructors expertise', 16, 1)
rollback transaction
End
GO
Run Code Online (Sandbox Code Playgroud)
我的问题是,"回滚交易"是否删除了行?如果它是'For Insert',那么'回滚事务'会删除该行中的行吗?
谢谢!!!
以下是我的代码.
def __init__(self):
self.node=[]
self.fronts=[]
self.GoalNode=['1','2','3','4','5','6','7','8','0']
self.StartNode=['1','2','3','4','5','6','7','8','0']
self.PreviousNode=[]
self.prePreviousNode=[]
self.PreviousCount=1
def Solve(self):
self.shufler(10)
......
def shufler(self):
while True:
node=self.StartNode
Run Code Online (Sandbox Code Playgroud)
以下是我收到的错误消息:
File "E:\Zoe's file\CMPT 310\Assign 2\astart8puzzle\AI8puzzle\py8puzzel.py", line 18, in Solve
self.shufler(10)
TypeError: shufler() takes exactly 1 positional argument (2 given)
Run Code Online (Sandbox Code Playgroud)
我不明白我在哪里提出两个论点.