执行SQL语句报错,希望都到各位的帮助

图片说明

3个回答

不是执行sql报错,而是连接字符串报错,数据库没有连上,换下连接字符串

没连上数据库吧,肯定报错咯

问题解决了,楼上的两位多谢,我传参的时候数据库后面应该带的数据库名称没带出来,导致没连上

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
希望各位大家能帮助相应的SQL语句
教学库有三个基本表如下:学生(学生号,姓名,性别,专业),课程(课程号,课程名,课程学分),选课(学生号,课程号,成绩)rnrn1.查找姓张并且两个字的学生学号、姓名和专业。rnrn2.查询有学生选修的课程名并保存到临时表TEMP。(要求使用自然连接)rnrn3.更新学号S5的学生选修的全部课程成绩为60分。rnrn4.添加学号S5的学生选修C1课程的信息,而且该学生尚未考试。rnrn5.创建视图V,显示统计学生的学号、姓名和考试平均成绩并升序排序。rnrn6.创建存储过程P,变量输入学生的学号显示学生所修课程及其成绩。rn
执行SQL语句报错。
[code=SQL]rnrnrnSET QUOTED_IDENTIFIER ON rnGOrnSET ANSI_NULLS ON rnGOrnset quoted_identifier offrnGOrnrnexec ('create PROC hisExchangeJour @' + @BeginDate + ' varchar(8),@' + @FinishDate + ' varchar(8), @' + @sfilename + 'varchar(50)'rnAS rnrn IF ( EXISTS ( SELECT * FROM tempdb.dbo.sysobjects WHERE name = "##hisExchangeJour" ))rn DROP TABLE ##hisExchangeJourrnrndeclare @' + @filename + ' varchar(30)' + 'rnset @' + @filename + ' = @' + @sfilename + 'rnrnselect oc_date as 交易日期,rn fund_account as 资金帐号, rn ltrim(rtrim(client_name)) as 客户姓名, rn stock_account as 股东代码,rn client_group as 客户组别,rn stock_code as 证券代码, rn stock_name as 证券名称, rn casern when entrust_bs = "1" then "买入"rn when entrust_bs = "2" then "卖出"rn end as 交易方向, rn deliver_status as 交易类别, rn deliver_status as 交易属性,rn sum(abs(occur_amount)) as 成交数量,rn sum(abs(occur_amount) * abs(business_price)) as 成交金额 rn into ##hisExchangeJourrn from @' + @filename +rn ' where (oc_date between @'+ @BeginDate + ' and @' + @FinishDate + ') 'rngroup by oc_date,rn fund_account, rn client_name, rn client_group,rn stock_account,rn stock_code, rn entrust_bs, rn deliver_status,rn stock_namern') rnrnrnGOrnSET QUOTED_IDENTIFIER OFF rnGOrnSET ANSI_NULLS ON rnGOrnrn提示:Must declare the variable '@BeginDate'. 如何处理,谢谢。rn[/code]
sql语句执行报错
Dim cnn As New ADODB.Connectionrn cnn.ConnectionString = "Provider=Microsoft.ace.Oledb.12.0;data source=" & strApppath & "\score.accdb;"rn cnn.Open()rn cnn.Execute("alter table 资料 alter 年龄 set check 年龄>=0 and 年龄<=100"),词句报错“ALTER TABLE 语句中的语法错误。”
执行sql语句报错
后台程序执行语句的时候,日志报错如下:rn INSERT INTO MEDIC_DEFECTSCONFIRMED_2014rn (SNrn ,UHIDrn ,DATE_VALIDATEDrn ,IDSrn ,PATIENT_IDrn ,PATIENTNAMErn ,SEXrn ,DIVISIONrn ,MEDIC_IDrn ,MEDIC_NAMErn ,MEDIC_DATErn ,DELETE_FLAGrn ,HIS_IN_NOrn ,HIS_OUT_NOrn )rn VALUESrn (@SNrn ,@UHIDrn ,@DATE_VALIDATEDrn ,@IDSrn ,@PATIENT_IDrn ,@PATIENTNAMErn ,@SEXrn ,@DIVISIONrn ,@MEDIC_IDrn ,@MEDIC_NAMErn ,@MEDIC_DATErn ,'0'rn ,@HIS_IN_NOrn ,@HIS_OUT_NO)rn rn,系统错误为索引超出范围。必须为非负值并小于集合大小。rn参数名: indexrnrn各位大神帮忙分析下是什么原因?
执行sql语句报错,求助!
if exists(select * from dbo.sysobjects where id=object_id(N'[dbo].[NN_QR_DELETE]')and objectproperty(id,N'IsTrigger')=1)rn在查询分析中执行提示“第2行:‘)’附近有语法错误。”rn哪位大侠知道问题出在哪了??
JdbcTemplate执行sql语句报错
今天执行一个sql语句,报错 java.sql.SQLSyntaxErrorException: ORA-00942,这是sql语句:rnSELECT p.proj_id As PROJECTDBID,rn proj.PROJ_SHORT_NAME PROJECTID,rn p.wbs_name PROJNAME,rn P0.UDF_TEXT As MRPNumber,rn e.EPS,rn SUBSTR(e.EPS, instr(e.EPS, '.', -1) + 1) AS EPS_NODErn FROM PROJWBS prn INNER JOIN PROJECT proj ON p.proj_id = proj.proj_idrn INNER JOIN (SELECT pc.proj_id,rn pv.proj_catg_short_name,rn pt.proj_catg_type_id,rn pv.proj_catg_idrn FROM PROJPCAT PCrn INNER JOIN PCATVAL PV on pc.proj_catg_id = pv.proj_catg_idrn INNER JOIN PCATTYPE PT on pt.proj_catg_type_id =rn pv.proj_catg_type_idrn WHERE pt.proj_catg_type =rn 'Mandatory Integration - SyncProject') pcvt1 on p.proj_id =rn pcvt1.proj_idrn AND pcvt1.proj_catg_short_name = 'Y'rn LEFT JOIN (SELECT FK_ID, UDF_TEXT, UDF_DATE, UDF_NUMBER, 'Y' AS UDF_EXISTSrn FROM UDFVALUE UVrn JOIN UDFTYPE UT ON UT.UDF_TYPE_ID = UV.UDF_TYPE_IDrn AND UT.UDF_TYPE_LABEL LIKErn 'MAND INT- DS COMMOPS ERP PROJ#'rn AND UT.TABLE_NAME LIKE 'PROJECT') P0 ON P0.FK_ID =rn P.PROJ_IDrn INNER JOIN (SELECT p.WBS_ID,rn REPLACE(trim(leading '\' FROMrn sys_connect_by_path(p.wbs_short_name, '\')),rn '\',rn '.') EPS,rn LEVELrn FROM PROJWBS prn INNER JOIN PROJECT proj ON p.proj_id = proj.proj_idrn START WITH p.parent_wbs_id IS NULLrn CONNECT BY PRIOR p.wbs_id = p.parent_wbs_idrn AND proj.project_flag = 'N') e ON e.WBS_ID =rn p.parent_wbs_idrn WHERE proj.project_flag = 'Y'rn AND p.proj_node_flag = 'Y'rn AND proj.orig_proj_id IS NULLrn AND (UPPER(proj.PROJ_SHORT_NAME) like ? or UPPER(p.wbs_name) like ?)rn ORDER BY EPS, EPS_NODE, PROJNAME rn rnjava调用:rnString projectUp = "%" + project.toUpperCase() + "%"; rnStringBuffer totalSQL = new StringBuffer(" SELECT count(*) FROM (");rn totalSQL.append(getProjects);rn totalSQL.append(") temp");rn System.out.println("totalSQL="+totalSQL); return jdbcTemplate.queryForInt(totalSQL.toString(),new String[]projectUp,projectUp);rn其中project是从页面传递的参数,getProject就是指向如上sql语句的属性,有setter,getter方法,希望大家帮忙解决,不胜感激
执行SQL语句时报错
String^ sOraConnString = "Data Source=L3DB1; User Id=lgmes; Password=lgmes;";rnrnrnString^ sOraCommand = "select * from CHeatID"; rnOracleConnection Conn( sOraConnString );rnrnConn.Open();rnOracleCommand Command( sOraCommand ); rnrnint iRcdCount = 0;rniRcdCount = Command.ExecuteNonQuery;rnrn报错类型的异常出现在System.data.oracleClient.dll中rn其他信息:无效操作,连接被关闭
oracle执行SQL语句报错
conn.BeginTransrnconn.Execute (sql1),程序执行到这一步报错,抛出“[Oracle][ODBC][Ora]ORA-01013”错误,sql1的内容为rnupdate terminmerch set term_id='00008525', standby = '111111111111|22111' where merch_id = '001033333333333' and term_id ='00009525'rn如果这一句在sql/plus中执行没问题,为什么在程序中就报错呢rn还有,如果没有term_id='00008525',则在程序,还是sql/plus中都能正确执行,这是什么原因
sql语句执行为什么报错
SQL> select nvl(da_xh.lsh,daml.lsh), nvl(da_xh.pid,'124660121304260011') from daml,da_xh rn 2 where daml.lsh = da_xh.lsh(+) and daml.pid = da_xh.pid(+);rn rn错误位于第1行:rnORA-01114: 将块写入文件 201 时出现 IO 错误 (块 # 2097033)rnORA-27069: skgfdisp: 尝试在文件范围外执行 I/OrnOSD-04026: 传递的参数无效。 (OS 2097039)rnORA-01114: 将块写入文件 201 时出现 IO 错误 (块 # 2097033)rnORA-27069: skgfdisp: 尝试在文件范围外执行 I/OrnOSD-04026: 传递的参数无效。 (OS 2097039)rnrn
sql语句执行报错问题
在PL/SQL 中执行以语句rnCREATE TABLE OrderFormrn( OFID number NOT NULL primary key,rn CustomerID number NOT NULL,rn CustomerName nvarchar2(50) collate Chinese_PRC_CI_AS NOT NULL,rn CustomerTel nvarchar2(50) COLLATE Chinese_PRC_CI_AS NULL,rn Corporation nvarchar2(50) COLLATE Chinese_PRC_CI_AS NULL,rn BrandName nvarchar2(50) COLLATE Chinese_PRC_CI_AS NULL,rn OrderDate nvarchar2(50) COLLATE Chinese_PRC_CI_AS NULL,rn)rn/rnrnORA-00907: 缺失右括号rnrn
新手提问一个sql执行语句的问题,希望得到帮助
我执行sql语句向数据库插入一条新的记录的时候,执行成功了,但是程序里面提示有错误。请问如何插入一条新的记录,违反主键约束该如何处理,等答案,先谢谢各位大神了。rnrnstring con = System.Configuration.ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString;rnSqlConnection xiaqikj = new SqlConnection(con);rn xiaqikj.Open();rn string xqkj = "INSERT INTO [ssc_Kai] (GameID,YearID,Status,AddTime ,EndTime) VALUES ('" + xiaqiqishu + "','" + DateTime.Now.Year.ToString() + "','0',getdate(),'" + xqsj + " 21:35:00' )";rn rn SqlCommand xqkjsl = new SqlCommand(xqkj, xiaqikj);rn xqkjsl.ExecuteReader();rnxiaqikj.Close();rnrnrn错误提示的地方xqkjsl.ExecuteReader();rnrnrnrnViolation of PRIMARY KEY constraint 'PK_ssc_List'. Cannot insert duplicate key in object 'ssc_Kai'.rnThe statement has been terminated.rnrn有道翻译rn违反主键约束“PK_ssc_List”。不能插入重复键对象“ssc_Kai”。rn  语句已终止。rn
希望得到各位的帮助
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy年MM月dd日HH时mm分"); rnjava.util.Date currentTime_1 = new java.util.Date(); rnString savedate=formatter.format(currentTime_1); rnrn我用这个直接得到系统时间,可是插入数据库的时候,我直接插入会报告错误。我该怎么转换呢?这样他才能插入数据库呀
帮助!SQL语句执行结果不对!
帮助!SQL语句执行结果不对!rnrn我有二个表,一个表的结构类此:rnTable1:rnFieldA(PK) FieldB FieldC FieldDrnA A1 A2 A3rnB B1 B2 B3rnC C1 C2 C3rnrn另一个表是 Table1的明细档,有可能没有明细项:rnTable2:rnField1(PK) Field2(PK) Field3 Field4rnA 1 kkkkk dkkfkdfrnA 2 dkkfk dfdfdfrnC 1 222 2222rnC 2 222rnrn我的SQL语句是:rnSelect Table1.FieldA,Table2.Field3rnFrom Table1 Left Join Table2 on Table1.FieldA = Table2.Field1rnWhere Table2.Field2 = '1'rnrn我要的结果是:rnrnrn我想要的结果是:rnFieldA Field3rnA kkkkkrnB rnC 222rnrn但实际返回的结果是:rnFieldA Field3rnA kkkkkrnC 222rnrn缺了rnFieldA Field3rnB rn这一条记录,rnrn而我的SQL是:rnSelect Table1.FieldA,Table2.Field3 rnFrom Table1 Left Join Table2 on Table1.FieldA = Table2.Field1 rnWhere Table2.Field2 = '1' or Table2.Field2 is NULL rn就能将记录取得,rn很是迷惑,还请高手指点一下原因……rnrnrnrn
如何跳过该报错的sql语句,执行下一个sql语句
循环往sql server中添加值时rn方法:rn /// 数据库名rn /// sql语句的集合rnpublic bool InsertData(string databaseName, List ls)rn rn string strCon1 = "Data Source=HEHANG-PC;Initial Catalog=" + databaseName + ";Persist Security Info=True;User ID=sa;Password=123456";rn SqlConnection sqlcon = new SqlConnection(strCon1);rn tryrn rn sqlcon.Open();rn rn catch (Exception ex)rn rn throw ex;rn rnrn SqlCommand sqlcmd = new SqlCommand();rn sqlcmd.Connection = sqlcon;rn rnrn tryrn rn foreach (string sql in ls)rn rn sqlcmd.CommandText = sql;rn sqlcmd.ExecuteNonQuery();rn rn rn return true;rn rn catch (Exception ex)rn rn continue;rn throw ex;rn rn finallyrn rn sqlcon.Close();rn rn rn当一条sql报错时,如何跳过该sql语句执行一条sql语句,并且保存报错的sql语句。
关于执行sql语句报错问题?
[img=http://p13.freep.cn/p.aspx?u=v20_p13_p_0912012317554708_0.png][/img]rnrn如果所示rnrn代码如下rnrnrnrnXp_regaddmultistringrnXp_regdeletekeyrnXp_regdeletevalue rnXp_regenumvalues rnXp_regread rnXp_regremovemultistring rnXp_regwrite rnrnrn这个语句少什么?
存储过程 执行sql语句报错,坐等大虾!
我有一条SQL语句。单独执行的时候,没有错误,但当我把它放在存储过程中执行,就会报“ 在 "TINUUMID,value(MAX(S" 后面找到异常标记rn"END-OF-STATEMENT"。预期标记可能包括:")"。 SQLSTATE=42601rn”这个错误,大侠们,帮忙看下是什么原因,有没有什么函数可以打印出将要执行的的sql语句rnrnrn[code=SQL] DECLARE GLOBAL TEMPORARY TABLE SESSION.LASTTIMErn ( CONTINUUMID VARCHAR(15),rn MAXTIME TIMESTAMP ) rn WITH REPLACErn NOT LOGGED; rnrnrnSET sqlStr1 = 'INSERT INTO SESSION.LASTTIME(CONTINUUMID,MAXTIME) SELECT HNM_TR_SITEANDCONID.CONTINUUMID,rn value(MAX(STATISTIC_DATE),timestamp((current timestamp)-1 DAY))rn FROM '||newTableName||' rn right JOIN HNM_TR_SITEANDCONID rn ON HNM_TR_SITEANDCONID.CONTINUUMID = '||newTableName||'.CONTINUUMID rn group by HNM_TR_SITEANDCONID.CONTINUUMID';rnrnEXECUTE IMMEDIATE sqlStr; --rnrnrn[/code]
MFC 用ExecuteSQL 执行 sql语句报错
strDelete = "delete from DBbackup";rn m_DataBase.ExecuteSQL(strDelete);rn这句不会报错rn strSql.Format("backup database dzx100 to Disk = '%s'",strFilePath);rn m_DataBase.ExecuteSQL(strSql);rn这句确会报错rnrn 求大神帮帮忙
执行SQL语句,程序报错3159
这个是我类里面的一个函数,我定义了一个全局的类adoconnectrn[code=C/C++]rnbool CADOCONECT::ExecuteSQL(CString bstrSQL)rnrn tryrn rn if(m_pConnection==NULL)rn rn AfxMessageBox(_T("数据库未连接"));rn rn m_pConnection->Execute((_bstr_t)bstrSQL,NULL,adCmdText);rn return TRUE;rnrn rn catch (_com_error e)rn rn CString errormessage;rn errormessage.Format(_T("执行SQL语句失败!\r\n错误信息:%s"),e.ErrorMessage());rn AfxMessageBox(errormessage);rn return FALSE;rn rnrn[/code]rnrn[code=C/C++]rnsql.Format(L"INSERT INTO [hotel].[dbo].[information] ([name],[sex],[id],[roomno],[persons],[datein],[dateout],[days],[price],[discount],[disprice],[totalprice],[deposit]) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",m_name,m_sex,m_id,m_roomno,m_persons,strdatein,strdateout,m_days,m_price,m_discount,m_disprice,m_totalprice,m_deposit);rnadoconnect.ExecuteSQL(sql);rn[/code]rnrn程序执行到m_pConnection->Execute((_bstr_t)bstrSQL,NULL,adCmdText);的时候就产生了错误,错误号就是3159,IDispatch error # 3159rn貌似是截断字符串或者二进制数据rn请问下这个怎么解决啊?
vb执行SQL INSERT语句报错问题
inser = "insert into hr_tm_monthresult(cpsn_num,vdepcode,cyear,cmonth,cpsn_name,nworkdays) values('" & spnum & "','" & sdepcode & "','" & dyear & "','" & smonth & "','" & sname & "'," & dmonthday & ")"rnrnrs.Open sel, strconn, adOpenDynamic, adLockBatchOptimisticrn objcon.Execute inserrnrnrn 前面几个变量都是字符型,dmonthday是single类型,执行上面这个语句总报')'附近有语法错,要是插入语句变成inser = "insert into hr_tm_monthresult(cpsn_num,vdepcode,cyear,cmonth,cpsn_name) values('" & spnum & "','" & sdepcode & "','" & dyear & "','" & smonth & "','" & sname & "')"是可以正常执行rn到底错在哪呢
为什么执行以下SQL语句报错:
我在SQL查询分析器里执行语句,会报错,怎么回事?rnrn报错提示:rn警告: 已创建表 '明细单主表',但其最大行大小(11271)超过了每行的最大字节数(8060)。如果结果行长度超过 8060 字节,则此表中行的 INSERT 或 UPDATE 将失败。rnrn报错语句:rnCREATE TABLE [dbo].[明细单主表] (rn [发票号] [varchar] (200) NOT NULL ,rn [输入日期] [datetime] NULL ,rn [核销单号] [varchar] (200) NULL ,rn [外运编号] [varchar] (200) NULL ,rn [报关单编号] [varchar] (200) NULL ,rn [报关单防伪号] [varchar] (200) NULL ,rn [合约号] [varchar] (200) NULL ,rn [信用证号码] [varchar] (200) NULL ,rn [开证行] [text] NULL ,rn [开证日期] [datetime] NULL ,rn [成交条件] [varchar] (200) NULL ,rn [收汇方式] [varchar] (200) NULL ,rn [贸易性质代码] [varchar] (200) NULL ,rn [贸易性质名称] [varchar] (200) NULL ,rn [贸易国别代码] [varchar] (200) NULL ,rn [贸易国别名] [varchar] (200) NULL ,rn [消费国别代码] [varchar] (200) NULL ,rn [消费国别名] [varchar] (200) NULL ,rn [受益人] [text] NULL ,rn [提单通知人] [text] NULL ,rn [收货人] [text] NULL ,rn [运输方式] [varchar] (200) NULL ,rn [运费方式] [varchar] (200) NULL ,rn [口岸] [varchar] (200) NULL ,rn [转船港] [varchar] (200) NULL ,rn [目的港LC指定] [varchar] (200) NULL ,rn [货妥日期] [datetime] NULL ,rn [可否转运] [varchar] (200) NULL ,rn [可否分批] [varchar] (200) NULL ,rn [装运期限] [datetime] NULL ,rn [有效期限] [datetime] NULL ,rn [折扣] [float] NULL ,rn [明佣] [float] NULL ,rn [暗佣] [float] NULL ,rn [原产地标记] [varchar] (200) NULL ,rn [币别] [varchar] (200) NULL ,rn [重量单位] [varchar] (200) NULL ,rn [发票总数] [float] NULL ,rn [总金额] [money] NULL ,rn [箱数] [float] NULL ,rn [毛重] [float] NULL ,rn [净重] [float] NULL ,rn [体积] [float] NULL ,rn [正本提单] [int] NULL ,rn [副本提单] [int] NULL ,rn [产地证通知人] [text] NULL ,rn [公司抬头] [text] NULL ,rn [唛头] [text] NULL ,rn [备注] [text] NULL ,rn [佣金信息] [text] NULL ,rn [报关单备注] [text] NULL ,rn [员工工号] [varchar] (200) NULL ,rn [员工名字] [varchar] (200) NULL ,rn [部门代码] [varchar] (200) NULL ,rn [部门名称] [varchar] (200) NULL ,rn [报审日期] [datetime] NULL ,rn [审单日期] [datetime] NULL ,rn [接收日期] [datetime] NULL ,rn [分单日期] [datetime] NULL ,rn [送银行日期] [datetime] NULL ,rn [收汇日期] [datetime] NULL ,rn [审单员工号] [varchar] (200) NULL ,rn [审单员姓名] [varchar] (200) NULL ,rn [制单员工号] [varchar] (200) NULL ,rn [制单员姓名] [varchar] (200) NULL ,rn [运输员工号] [varchar] (200) NULL ,rn [运输员姓名] [varchar] (200) NULL ,rn [FORMA号] [varchar] (200) NULL ,rn [产地证号] [varchar] (200) NULL ,rn [汇票期限] [varchar] (200) NULL ,rn [汇票日期] [datetime] NULL ,rn [汇票付款人] [text] NULL ,rn [代收行] [text] NULL ,rn [特殊条款] [text] NULL ,rn [生产厂家] [text] NULL ,rn [制单日期] [datetime] NULL ,rn [运费] [money] NULL ,rn [折扣说明] [text] NULL ,rn [金额] [money] NULL ,rn [保单号] [varchar] (200) NULL ,rn [预保单号] [varchar] (200) NULL ,rn [船名] [varchar] (200) NULL ,rn [船次] [varchar] (200) NULL ,rn [出运日] [datetime] NULL ,rn [保险公司代码] [varchar] (200) NULL ,rn [保险公司名称] [varchar] (200) NULL ,rn [投保加成] [float] NULL ,rn [赔款币别] [varchar] (200) NULL ,rn [赔款地点] [varchar] (200) NULL ,rn [保险费] [money] NULL ,rn [保险备注] [text] NULL ,rn [保险日期] [datetime] NULL ,rn [通用备注] [text] NULL ,rn [发票备注] [text] NULL ,rn [汇票备注] [text] NULL ,rn [装箱单备注] [text] NULL ,rn [产地证旧备注] [text] NULL ,rn [产地证新备注] [text] NULL ,rn [FORMA备注] [text] NULL ,rn [产地证申请书备注] [text] NULL ,rn [FORMA申请书备注] [text] NULL ,rn [装船声明备注] [text] NULL ,rn [装船通知书备注] [text] NULL ,rn [受益人声明备注] [text] NULL ,rn [品质检验证书备注] [text] NULL ,rn [新海关发票备注] [text] NULL ,rn [加海关发票备注] [text] NULL ,rn [美海关发票备注] [text] NULL ,rn [投保单保险备注] [text] NULL ,rn [证明信内容] [text] NULL ,rn [传真对象] [text] NULL ,rn [传真注释] [varchar] (200) NULL ,rn [传真号码] [varchar] (200) NULL ,rn [传真内容] [text] NULL ,rn [电传客户] [varchar] (200) NULL ,rn [电传国别] [varchar] (200) NULL ,rn [电传号码] [varchar] (200) NULL ,rn [电传内容] [text] NULL ,rn [信封内容] [text] NULL ,rn [邮局收据内容] [text] NULLrn) rnGOrnrn
在C#里面执行备份的SQL语句报错
BACKUP DATABASE [MaterialDataBasev2] TO DISK = N'C:\Users\Allen\Desktop\123.bak' WITH NOFORMAT,NOINIT,NAME = N'123',SKIP,NOREWIND,NOUNLOAD,STATS = 10rnrn在C#里面执行这个SQL语句报错rnrn无法打开备份设备 'C:\Users\Allen\Desktop\123.bak'。出现操作系统错误 5(拒绝访问。)。rnBACKUP DATABASE 正在异常终止。rnrn这是为什么哇?
PreparedStatement替换值,执行SQL语句报错
参数:pageNumber:0;pageSize:5;rn做的一个分页查询数据方法;rn为什么执行红色那块就跳异常里边去了,哪里写错了呢,请指出!rn[code="java"]rnpublic List allPersons(int pageNumber, int pageSize) rn List list = new ArrayList();rn String sql = "select * from person limit ?,?";rn PreparedStatement ps = null;rn try rn ps = dbp.getConn().prepareStatement(sql);rn ps.setInt(1, (pageNumber-1)*pageSize);rn ps.setInt(2, pageSize);rn [color=red]ResultSet rs = ps.executeQuery();[/color]rn while(rs.next())rn Person person = new Person();rn person.setPersonId(rs.getInt("personId"));rn person.setPersonName(rs.getString("personName"));rn person.setPersoninfo(rs.getString("personInfo"));rn person.setPersonAge(rs.getInt("personAge"));rn list.add(person);rn rn catch (Exception e) rn e.printStackTrace();rn rn return list;rn rn[/code]
SparkSql执行到sql语句就会报错
18/10/30 11:52:17 INFO yarn.Client:       client token: Token { kind: YARN_CLIENT_TOKEN, service:  }      diagnostics: N/A      ApplicationMaster host: 10.16.208.172      ApplicationMaster RPC port: 0...
多线程中执行SQL语句报错
我通过创建一线程来实现对数据库的备份还原,每次执行到SQL.ADD('......');时候就报错:尚未调用Coinitialize.rn请高手指点!在线苦候!
DB2数据库执行SQL语句报错
[DB2/AIX64] SQL1224N 由于数据库管理器发生了错误或者被强制中断,从而无法接受新的请求,已终止正在处理的所有请求或者已终止所指定的请求。 LINE NUMBER=2. SQLSTATE=55032
sql中能执行的语句为什么总报错
语句如下rnselect xm_lb, lb_bm,sum(xm_je) as xm_je1 from (select * from v_sj1 ) GROUP BY xm_lb,lb_bmrnrn在SQL中执行能得到正确结果,但到VB中执行总是提示 GROUP BY 附近语法错误,请问是怎么回事,怎样解决rnrn谢谢!
同样的语句,acess报错,sql serer执行
[img=http://img.my.csdn.net/uploads/201212/25/1356443622_5042.png][/img]rn[img=http://img.my.csdn.net/uploads/201212/25/1356443636_9711.png][/img]rnrn你们告诉我access应该怎么该好吗?
一条sql语句在mysql中执行报错
SELECT count (*) FROM UtiSubject where id like '%2%' rnrnrn这为什么错啊高手给予答案
我的SQL语句执行为什么报错?
CDatabase *m_pDatabase=new CDatabase;rnCYkrecordset ykset(m_pDatabase);rnCString str;rnrnstr.format("select max(id) from yk_table");//id是我表中的一个INT 字段rnrnykset.Open(CRecordset::snapshot,_T(str));rnrn执行到此程序报错。为什么?语法的问题吗?rn.............
执行下列SQL语句时报错
with dm.ADOQSource dorn beginrn SQL.Text:='SELECT (case when a.colorder=1 then d.name else '' end) N'+'''表名'''+',a.colorder N'+'''字段序号'''+',a.name N+'+'''字段名'''+','+rn '(case when COLUMNPROPERTY( a.id,a.name,'+'''IsIdentity'''+')=1 then '+'''√'''+'else'+ '''+'''+' end) N'+'''标识,'''+rn '(case when (SELECT count(*) FROM sysobjects'+rn 'WHERE (name in (SELECT name FROM sysindexes'+rn 'WHERE (id = a.id) AND (indid in'+rn '(SELECT indid FROM sysindexkeys'+rn 'WHERE (id = a.id) AND (colid in'+rn '(SELECT colid FROM syscolumns'+rn 'WHERE (id = a.id) AND (name = a.name))))))) AND'+rn '(xtype = '+'''PK'''+'))>0 then '+'''√'''+' else'+ ''''+''''+ 'end) N'+'''主键,'''+rn 'b.name N'+'''类型'''+','+rn 'a.length N'+'''占用字节数,'''+rn 'COLUMNPROPERTY(a.id,a.name,'+'''PRECISION'''=') as N'+'''长度'''+',' +rn 'isnull(COLUMNPROPERTY(a.id,a.name,'+'''Scale'''+'),0) as N'+'''小数位数'''+','+rn '(case when a.isnullable=1 then '+'''√'''+'else'+ ''''+''''+' end) N'+'''允许空'''+','+rn 'isnull(e.text,'') N'+'''默认值'''+','+rn 'isnull(g.[value],'') AS N'+'''字段说明'''+rn 'FROM syscolumns a left join systypes b'+rn 'on a.xtype=b.xusertype'+rn 'inner join sysobjects d'+rn 'on a.id=d.id and d.xtype='+'''U'''+' and d.name<>'+'''dtproperties'''+rn 'left join syscomments e on a.cdefault=e.id left join sysproperties g on a.id=g.id AND a.colid = g.smallid'+rn 'order by object_name(a.id),a.colorder';rn end;rn dm.ADOQSource.ExecSQL;rnrn报错如下:rnrn[DCC Error] dbconfigUnit.pas(177): E2010 Incompatible types: 'WideString' and 'Boolean'rn[DCC Error] Sinice.dpr(12): F2063 Could not compile used unit 'dbconfigUnit.pas'rn
执行SQL语句报错,不知错在哪。
[code=SQL]rnSET QUOTED_IDENTIFIER ON rnGOrnSET ANSI_NULLS ON rnGOrnset quoted_identifier offrnGOrnrnexec('rnalter PROC hisExchangeJour ' + @BeginDate + 'varchar(8),' + @FinishDate + 'varchar(8), ' + @sfilename + 'varchar(50)rnAS rnrn IF ( EXISTS ( SELECT * FROM tempdb.dbo.sysobjects WHERE name = "##hisExchangeJour" ))rn DROP TABLE ##hisExchangeJourrnrndeclare ' + @filename + ' varchar(30)' + 'rnset ' + @filename + ' = ' + @sfilename + 'rnrnselect oc_date as 交易日期,rn fund_account as 资金帐号, rn ltrim(rtrim(client_name)) as 客户姓名, rn stock_account as 股东代码,rn client_group as 客户组别,rn stock_code as 证券代码, rn stock_name as 证券名称, rn casern when entrust_bs = "1" then "买入"rn when entrust_bs = "2" then "卖出"rn end as 交易方向, rn /* casern when real_type = 0 then "委托"rn when real_type = 1 then "查询"rn when real_type = 2 then "撤单"rn when real_type = 3 then "补单"rn end as 交易类别, */rn deliver_status as 交易类别, rn /* casern when real_status= 0 then "证券买卖"rn when real_status= 1 then "证券配股"rn when real_status= 2 then "配股入帐"rn when real_status= 3 then "红股入帐"rn when real_status= 4 then "新股入帐"rn when real_status= 5 then "权证入帐"rn when real_status= 6 then "股息入帐"rn when real_status= 7 then "证券托管"rn when real_status= 8 then "证券转托"rn when real_status= 9 then "证券冻结"rn when real_status= "A" then "指定交易"rn when real_status= "B" then "余额入账"rn when real_status= "C" then "申购配号"rn when real_status= "D" then "申购返款"rn when real_status= "E" then "申购中签"rn when real_status= "F" then "新股申购"rn when real_status= "G" then "购回业务"rn when real_status= "H" then "回购业务"rn when real_status= "I" then "成交通知"rn when real_status= "J" then "转债转股"rn when real_status= "K" then "转债回售"rn when real_status= "L" then "转债赎回"rn when real_status= "M" then "配售中签"rn when real_status= "N" then "ETF申购"rn when real_status= "O" then "配售确认"rn when real_status= "P" then "配售入账"rn when real_status= "Q" then "前台收费"rn when real_status= "R" then "证券质押"rn when real_status= "S" then "大宗交易"rn when real_status= "T" then "预受要约"rn when real_status= "U" then "收购入帐"rn end as 交易属性, */rn deliver_status as 交易属性,rn sum(abs(occur_amount)) as 成交数量,rn sum(abs(occur_amount) * abs(business_price)) as 成交金额 rn into ##hisExchangeJourrn from ' + @filename +rn ' where (oc_date between '+ @BeginDate + ' and ' + @FinishDate + ') rngroup by oc_date,rn fund_account, rn client_name, rn client_group,rn stock_account,rn stock_code, rn entrust_bs, rn deliver_status,rn -- real_type,rn -- real_status, rn stock_namern') rnrnrnGOrnSET QUOTED_IDENTIFIER OFF rnGOrnSET ANSI_NULLS ON rnGOrnrnrn报错: 必须声明变量'@BeginDate'. 如何处理???rnrn[/code]
执行多条sql语句为什么会报错???
[code=PHP]rnTo delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.', 0, '1', '', '', 0, 0);rn")rn?>rn[/code]rn如果单独执行创建表和插入表的操作,正常,,但是像这样把sql语句写在一起,居然不执行,,求原因。。。。。
pb11.5 连接oracle数据库 执行sql语句 报错
DECLARE ll_count number(18,0):=0;rnBEGIN select count(*) into ll_count from user_tables where table_name ='SFZZ_NEW';rn if ll_count=0 then rn beginrn execute immediate 'CREATE TABLE SFZZ_NEW(rn XH varchar2(20) NOT NULL,rn XM varchar2(30) NOT NULL,rn rxnd varchar2(4) NOT NULL,rn BMDM varchar2(12) NOT NULL,rn ZYDM varchar2(12) NOT NULL,rn SFQJDM varchar2(13) NOT NULL,rn SFQJMC varchar2(60) NOT NULL,rn SFXMDM varchar2(12) NOT NULL,rn SFXMMC varchar2(60) NOT NULL,rn YJJE number(18, 2) NULL,rn SJJE number(18, 2) NULL,rn JMJE number(18, 2) NULL,rn TFJE number(18, 2) NULL,rn QFJE number(18, 2) NULL)';rn end;rn END IF;rnend;rn在sqldeveloper当中执行没有问题 通过pb直接执行sql语句报错rnORA-06550: line 1, column 35:rnPLS-00103: Encountered the symbol "" when expecting one of the following:rnrn begin function package pragma procedure subtype type usern formrn current cursorrnThe symbol "" was ignored.rnORA-06550: line 2, column 84:rnPLS-00103: Encountered the symbol "" when expecting one of the following:rnrn begin case declare end exception exit for goto if loop modrn null pragma raise return select update while withrn rn
连续执行sql语句后报错
在客户端调用存储过程以后,执行update语句,此语句执行正常,然后接着执行delete语句,程序报错,错误是函数序列错误。编程工具用的是delphi,执行语句用的是一般的query控件。
exec执行拼接的sql语句报错
declare @fieldCount int,rn @OldTalbeName nvarchar(100)rn select @OldTalbeName= '3D1147DE-0559-45B7-8B83-6D51620FBB6E'rn exec( 'select'+ @fieldCount+' = COUNT(*) from MyDataCentre.[dbo].['+@OldTalbeName+'] where Field243 is not null and DATALENGTH(field243)>0 and ClientID = 6425')rnprint @fieldCountrn这样写为什么会报错?提示=号附近语法错误rn
通过JDBC驱动执行sql语句报错
语句如下:rnselect * from dbo.getAllProcList('') as a where procname in ('任务单流程','委托单流程')rn and (exists (select consignid from view_consignProduct b where b.consignid=a.taskid and proid='PR0000003')or exists (select taskid from view_TaskProduct c where a.taskid=c.taskid and pid='PR0000003'))rnrn其中dbo.getAllProcList('')是一个函数,返回一个表rnrn这个语句在查询分析器中可以执行返回结果,但在程序中通过JDBC驱动访问数据库执行就报错“列前缀 'a' 与查询中所用的表名或别名不匹配”,请问微软的jdbc驱动是否有bug
mybatis执行多条sql语句报错
报错在第二条sql语句 解决,在spring.datasource.url配置中添加&amp;allowMultiQueries=true以此允许执行多条sql
amoeba 执行sql语句报错1064
环境:1台amoeba3.0.4(读写分离) 两个mysql5.6(主从)rn问题1:客户端navicat用sql语句查询, 或者项目运行调用sql语句查询,([b]执行结果是正确的[/b][size=18px][/size])出现错误rnnavicat报错信息:rn[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*100,3), '%') AS `Percentage` FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=' at line 1rn查看logs/router.logrn[code=html]2017-07-31 16:12:10,679 ERROR route.AbstractQueryRouter - SELECT STATE AS `Status`, ROUND(SUM(DURATION),7) AS `Duration`, CONCAT(ROUND(SUM(DURATION)/*100,3), '%') AS `Percentage` FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID= GROUP BY STATE ORDER BY SEQ;rncom.meidusa.amoeba.parser.ParseException: com.meidusa.amoeba.mysql.parser.sql.ParseException: Encountered "*" at line 1, column 92.rnWas expecting one of:rn "CASE" ...rn "CAST" ...rn "NULL" ...rn "TRUE" ...rn "FALSE" ...rn "INTERVAL" ...rn ...rn ...rn ...rn ...rn ...rn ...rn ...rn "(" ...rn "`" ...rn "+" ...rn "-" ...rn ...rn "`" ...rn ...rn ...rn ...rn rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.doParse(MysqlParser.java:117)rn at com.meidusa.amoeba.route.SqlBaseQueryRouter.parseStatement(SqlBaseQueryRouter.java:138)rn at com.meidusa.amoeba.route.SqlBaseQueryRouter.evaluateTable(SqlBaseQueryRouter.java:50)rn at com.meidusa.amoeba.route.SqlBaseQueryRouter.evaluateTable(SqlBaseQueryRouter.java:1)rn at com.meidusa.amoeba.route.AbstractQueryRouter.evaluate(AbstractQueryRouter.java:136)rn at com.meidusa.amoeba.route.AbstractQueryRouter.selectPool(AbstractQueryRouter.java:411)rn at com.meidusa.amoeba.mysql.parser.MysqlQueryRouter.selectPool(MysqlQueryRouter.java:59)rn at com.meidusa.amoeba.mysql.parser.MysqlQueryRouter.selectPool(MysqlQueryRouter.java:1)rn at com.meidusa.amoeba.route.AbstractQueryRouter.doRoute(AbstractQueryRouter.java:111)rn at com.meidusa.amoeba.mysql.handler.MySqlCommandDispatcher.handleQueryCommandMessage(MySqlCommandDispatcher.java:98)rn at com.meidusa.amoeba.mysql.handler.MySqlCommandDispatcher$1.run(MySqlCommandDispatcher.java:242)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at java.lang.Thread.run(Thread.java:745)rnCaused by: com.meidusa.amoeba.mysql.parser.sql.ParseException: Encountered "*" at line 1, column 92.rnWas expecting one of:rn "CASE" ...rn "CAST" ...rn "NULL" ...rn "TRUE" ...rn "FALSE" ...rn "INTERVAL" ...rn ...rn ...rn ...rn ...rn ...rn ...rn ...rn "(" ...rn "`" ...rn "+" ...rn "-" ...rn ...rn "`" ...rn ...rn ...rn ...rn rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.generateParseException(MysqlParser.java:5848)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.jj_consume_token(MysqlParser.java:5718)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLPrimaryExpression(MysqlParser.java:3305)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLUnaryExpression(MysqlParser.java:3106)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLMultiplicativeExpression(MysqlParser.java:3061)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLAddSubtractExpression(MysqlParser.java:2964)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLSimpleExpression(MysqlParser.java:2953)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLExpressionList(MysqlParser.java:2746)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.FunctionCall(MysqlParser.java:3359)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLPrimaryExpression(MysqlParser.java:3291)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLUnaryExpression(MysqlParser.java:3106)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLMultiplicativeExpression(MysqlParser.java:3025)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLAddSubtractExpression(MysqlParser.java:2964)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLSimpleExpression(MysqlParser.java:2953)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.OverloadedFunctionCall(MysqlParser.java:3452)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLPrimaryExpression(MysqlParser.java:3276)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLUnaryExpression(MysqlParser.java:3106)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLMultiplicativeExpression(MysqlParser.java:3025)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLAddSubtractExpression(MysqlParser.java:2964)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SQLSimpleExpression(MysqlParser.java:2953)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SelectItem(MysqlParser.java:2002)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SelectList(MysqlParser.java:1980)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SelectClause(MysqlParser.java:1943)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SubSelectStatement(MysqlParser.java:1734)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.FullSelectStatement(MysqlParser.java:1681)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.SelectQuery(MysqlParser.java:1309)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.parserInner(MysqlParser.java:355)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.parse(MysqlParser.java:268)rn at com.meidusa.amoeba.mysql.parser.sql.MysqlParser.doParse(MysqlParser.java:114)rn ... 13 morern[/code]rnrnrn问题2:事件无法回滚rn rn分析:在dos命令下做,查询等操作,无此报错信息!!!难道是跟Navicat不兼容?跟我的项目不兼容?rnrn请大神请求支援!!
Access语句执行报错
我在VC里写了一条SQL语句删除access数据库指定日期的数据项,但是那条语句在access里可以执行,为什么嵌在vc里就报错了呢?我可以肯定数据库是打开的,因为别的语句都能执行,就这个不行。大家帮我看看是什么原因啊rnCString strdate,strdate2,strsql;rn_variant_t aff;rn((CDateTimeCtrl*)GetDlgItem(IDC_DATETIMEPICKER1))->GetWindowText(strdate);rnstrdate2.Format(_T("DateAdd(\"d\",1,#%s#)"),strdate);rnstrsql.Format(_T("delete from TestList where T_test_time between #%s# and %s"),strdate,strdate2);rntryrn rn m_pConnection->Execute((_bstr_t)strsql,&aff,adCmdText);rn rn catch(_com_error e)rn rn AfxMessageBox(_T("操作未执行,该数据不存在或已被删除!"));rn rn
执行语句报错
写了一个函数如下: rncreate or replace function NewFormatName(sorderid in orderhist.orderid%type) rnreturn varchar2 is returnProName varchar2(3000); rnv_proName varchar2(500); rnv_num number(10); rnv_result varchar2(1000); rncursor c_proName is rnselect decode(od.prodname,'','',od.prodname) || '*' ||decode(od.upnum,0,'',od.upnum) || decode(od.spnum,0,'',od.spnum) from orderdet od,orderhist oh where od.orderid=oh.orderid; rn begin rn open c_proName; rn loop rn fetch c_proName into v_result; rn exit when c_proName%notfound; rn returnProName:=returnProName ||' ' || v_result; rn end loop; rnclose c_proName; rnreturn (returnProName); rnend NewFormatName; rnrnod.upnum为number(10)类型rnrn写了个函数,运行函数没问题,但是在SQL中调用的时候报错:rnORA-06502 PL/SQL 数字或值错误,ORA-06512 rn指向returnProName:=returnProName ||' ' || v_result;这一行 rnrn调用的SQL: rn select NewFormatName(orderhist.orderid) as 品名,orderhist.parcdt as 投递日期 rn From orderhist, CONTACT, ems, PHONE, Address, Topic, usr, grp,orderdet rnwhere orderhist.contactid = contact.contactid rn and orderhist.spellid = ems.spellid(+) rn and phone.phoneid = rn (select min(phoneid) from phone where phone.contactid = orderhist.getcontactid) rn and orderhist.contactid = address.contactid rn and topic.contactid(+) = contact.contactid
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview