Лог ошибки.
INSERT INTO Delivery_statistics (Номенклатура товара, Кол-во, Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)"
QODBCResult::exec: Unable to execute statement: "[Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций"
"[Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций"
"QODBC3: Unable to execute statement"`
Код
QSqlQuery Query;
QString QueryStr = "INSERT INTO "+nameTable+" (Номенклатура товара, Кол-во, Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)";
qDebug()<<QueryStr;
Query.prepare(QueryStr);
if(!Query.exec())
{
qDebug()<<Query.lastError().databaseText();
qDebug()<<Query.lastError().driverText();
}
Arhadthedev
11.5k8 золотых знаков42 серебряных знака69 бронзовых знаков
задан 24 мая 2017 в 19:09
Если это Access, попробуйте так:
QString QueryStr = "INSERT INTO "+nameTable+" ([Номенклатура товара], [Кол-во], Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)";
ответ дан 24 мая 2017 в 19:40
msimsi
11.5k16 серебряных знаков16 бронзовых знаков
5
Последний параметр должен быть в кавычках
ответ дан 24 мая 2017 в 19:39
dkfancskadkfancska
1191 серебряный знак5 бронзовых знаков
1
Irina3gger
04.07.17
✎
10:41
Доброго времени. Возникла такая проблема, В справочнике создала новый реквизит, но при сохранение выдает ошибку:
SQL State:HY010
Native:0
Message:[Microsoft][ODBC SQL Server Driver] Ошибка последовательности функций
Файлы sqlsrv32.dll sqlsrv32.rll odbcbcp.dll были заменены еще при установке SQL Server
Подскажите в чем еще может быть проблема?
Ёпрст
04.07.17
✎
10:42
(0) только в этом
Ёпрст
04.07.17
✎
10:44
Если что, новый реквизит добавьте ручоками.
В табличку скуля через альтер, и потом просто подмените мд и ддс. Усё
Irina3gger
04.07.17
✎
10:49
(2) Можете пожалуйста повторить еще раз что сделать? А то я не очень поняла
Ёпрст
04.07.17
✎
10:52
(3)
1. на пустой базе получить новый мд и ддс с добавленным реквизитом,
2.в рабочей базе через alter table добавить этот реквизит в соответствующую табличку справочника.
3. Далее, подменить мд и ддс в рабочей на те, что получены в п.1.
4. Наслаждаться, кушать печенки
https://msdn.microsoft.com/ru-ru/library/ms190273(SQL.90).aspx
Ёпрст
04.07.17
✎
10:53
Альтернативный вариант
1.Поставить скуль, НЕ меняя никакие библиотеки в нём.
2.Поставить секретный релиз платформы 1с
3.Наслаждаться, кушать печенки
Builder
04.07.17
✎
10:56
(5) Это самый правильный вариант.
Секретный 7.7 + SQL 2008 работает стабильно.
Irina3gger
04.07.17
✎
10:57
Спасибо большое буду пробовать.
Slypower
05.07.17
✎
09:51
Или поставить ХР, на ней данная ошибка не будет проявляться.
The problem
During a very simple insert query, using PDO with an ODBC driver for a DB2 database, the driver returns the following error:
SQLSTATE[HY010]: Function sequence error: 0 [Microsoft][Driver Manager ODBC] [italian message translation] (SQLExecute[0] at ext\pdo_odbc\odbc_stmt.c:254)
The query itself is a prepared statement insert, with strings and dates. [italian message translation] just says «Function sequence error» in italian.
The research
This SO question reports the same problem, but occurred during a SELECT query, which is not my case
This PHP bug report reports the same problem, but I’ve determined that’s not my case either.
The question
Why does a simple insert cause a function sequence error with SQLSTATE[HY010]?
asked Dec 3, 2014 at 10:15
Reading from the PHP bug report, users have reported that the issue is related to the format of the date being inserted, because (in that particular case) it was missing some digits from the months number.
That made me think: maybe the length of some input data was incompatible with the table column. In fact, I was writing 80 characters where only 60 could fit.
The solution
Check your input values: length, format and type. One of these may be incompatible with the column you’re writing into. I’d expect a different message from the driver to be honest (data truncated in my case), because the problem isn’t too hard to solve if you have better information.
As soon as I reduced the input length below the maximum value allowed, the query executed successfully
answered Dec 3, 2014 at 10:15
STT LCUSTT LCU
4,3484 gold badges29 silver badges47 bronze badges
Содержание
- Function sequence error sql
- Answered by:
- Question
- Function sequence error sql
- Answered by:
- Question
- Answers
- All replies
- Error message when an application uses ODBC to bind a TVP and a subtype as DAE in SQL Server 2008: «HY010, [Microsoft][SQL Server Native Client 10.0]Function sequence error»
- Symptoms
- Resolution
- Status
- More Information
- References
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
When calling SQLFetch() in our application, the error status «HY010: function sequence error» is returned when using SQL Server 2008 R2. The ODBC trace log contains these entries:
otsvcctl 1954-13bc ENTER SQLGetData
HSTMT 037BE728
UWORD 3
SWORD -8
PTR 0x02D24E1C
SQLLEN 256
SQLLEN * 0x0012BF6C
otsvcctl 1954-13bc EXIT SQLGetData with return code 0 (SQL_SUCCESS)
HSTMT 037BE728
UWORD 3
SWORD -8
PTR 0x02D24E1C [ 14] «winword»
SQLLEN 256
SQLLEN * 0x0012BF6C (14)
otsvcctl 1954-13bc ENTER SQLFetch
HSTMT 037BE728
otsvcctl 1954-13bc EXIT SQLFetch with return code -1 (SQL_ERROR)
HSTMT 037BE728
DIAG [HY010] [Microsoft][SQL Server Native Client 10.0]Function sequence error (0)
If I understand http://msdn.microsoft.com/en-us/library/ms710996(v=VS.85).aspx and http://msdn.microsoft.com/en-us/library/ms712424(v=VS.85).aspx correctly, SQLFetch() never should return HY010 if a previous SQLGetData() succeeded on the same statement handle (because SQLGetData() causes the statement handle to remain in state S6 and SQLFetch() never can return HY010 in state S6).
Is this right, or is there any condition that could cause HY010 in this case? Are there any debugging options that I could use to determine the reason of the HY010 error?
Источник
Function sequence error sql
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
I am migrating a application from Linux to windows 8.
And the database of this application is migrated from Oracle 11g database to MS SQL server 2014 using SSMA.
Schema and data are migrated successfully.
Now when I run below command from application. I get this error as shown below:
enable index Originator;
Error: #1900068: enable index failed
System Error: #1400000: State HY010: [Microsoft][SQL Server Native Client 11.0]Function sequence error
Earlier I was getting below error while executing this command.
So I added that filegroup to the database in SQL.
I also added all required data(.mdf) and index files(.ndf) and did the schema and data migration.
After doing this I executed this command again and started getting above error.
Please suggest me how can I resolve this 🙁 ?
enable index Originator;
Error: #1900068: enable index failed
System Error: #1500811: Error executing SQL: create table ix5687465873(
id int not null,
System Error: #1: State 42000: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid filegroup specified.
Answers
Here is the snippet which shows why odbc data source is used:
For ENOVIA Studio Modeling Platform Rich Clients .
If this is a 3rd party application you should seek their support for proper configuration. And you should _almost never_ be converting the database on your own. The ISV typically has a supported SQL Server schema and supported data migration procedures for a cross-platform database migration.
- Proposed as answer by Qiuyun Yu Microsoft contingent staff Friday, September 19, 2014 11:53 AM
- Marked as answer by Lydia Zhang Microsoft contingent staff Monday, October 6, 2014 7:23 AM
Satish Kartan http://www.sqlfood.com/
Yes, this filegroup was not existing earlier, thats why I got this error.
Now when I have created this filegroup, I am getting a new error as shown below.
enable index Originator;
Error: #1900068: enable index failed
System Error: #1400000: State HY010: [Microsoft][SQL Server Native Client 11.0]Function sequence error
Satish Kartan http://www.sqlfood.com/
>Can you post the exact DDL that you are running to create this table?
And the exact command the application is sending. «enable index Originator;» is not a valid TSQL command, and I don’t think it’s valid in Oracle either.
- Proposed as answer by Qiuyun Yu Microsoft contingent staff Tuesday, September 16, 2014 12:14 PM
SQL commands sent to to MSSQL on executing that command are :
drop table ix5687465873;
create table ix5687465873(
id int not null,
select * from table1 where Oid=?
?=1
—>select
select Oid1,Value1 from table2 where type=?
?=12345
—>select
—>select
insert into ix5687465873 values (. )
?=-1234567890
?=Abcd_test
—>insert
rollback
Table is created but only 1024 lines are inserted in it and after that it does a rollback.
However, it is not suppose to do a rollback but insert more lines. And drop and create other tables.
What kind of app is it? Can you share the source code that is causing the error?
Is the app creating tables at runtime?
Satish Kartan http://www.sqlfood.com/
The application is inserting each row at a time it seems and then doing a rollback after inserting 1024 rows.
I tried inserting all rows at once in this table manually in a single insert statement (approx. 64000 rows) in MS SQL then it is inserted successfully.
However, when I do it from application using command enable index then every time it is inserting 1024 rows
and then it does a rollback.
For eg. like this
insert into ix5687465873 values (. )
?=1898139624
?=
—>insert
?=1801268155
?=
—>insert
?=-573488584
?=
Satish Kartan http://www.sqlfood.com/
Profiler will also give you the raw error message returned in the «User Error Message» event.
I started the profiler and then executed the enable index command.
But I didn’t see any error message in profiler.
Also, I tried inserting the entire data manually by executing below query directly in ms sql then all 63k rows are inserted, so it doesn’t look like there is any problem in data.
insert into ix5687465873 (id, v1)
select Oid1,Value1 from table2 where type =12345
Also, I tried odbc tracing which shows below error.
Still I am unable to get what could be the cause of this error.
mql 1224-e28 EXIT SQLFetch with return code -1 (SQL_ERROR)
HSTMT 0x00000000048D78C0
DIAG [HY010] [Microsoft][SQL Server Native Client 11.0]Function sequence error (0)
If you see no error then your application is causing the rollback. Profiler trace has transaction events that should show that too.
>DIAG [HY010] [Microsoft][SQL Server Native Client 11.0]Function sequence error (0)
I thought this was a Java app. In that case it shouldn’t be using SQL Native Client. It should be using the Microsoft JDBC Driver for SQL Server
Is the app using the unsupported JDBC-ODBC bridge:
Oracle does not support the JDBC-ODBC Bridge. Oracle recommends that you use JDBC drivers provided by the vendor of your database instead of the JDBC-ODBC Bridge
It looks like you application is rolling back the transaction and then attempting to fetch from an open cursor. This doesn’t work.
The questions are:
1) Why are you using ODBC in a Java app instead of the supported Microsoft JDBC Driver?
2) Why is your application causing a rollback.
1) Why are you using ODBC in a Java app instead of the supported Microsoft JDBC Driver?
It is recommended by vendor. See page 9 on attached pdf in below link.
2) Why is your application causing a rollback.
Thats what we are trying to figure out.
Between I tried connecting application to a vanilla database and executing this command then it is happening successfully. In that database there is no data.
When I try to connect to my database then only 1024 rows are getting inserted and then rollback happening.
So trying to find the cause for rollback.
Here is the snippet which shows why odbc data source is used:
For ENOVIA Studio Modeling Platform Rich Clients such as MQL, Matrix, System, and Business,
the supported operating system architectures have changed. ENOVIA V6R2010x and previous
releases were 32-bit only, while ENOVIA V6R2011 has both 32-bit and 64-bit versions. This
means that for 32-bit applications running on 64-bit operating system versions, the required
ODBC Data Source names have to be created using the 32-bit version of the ODBC Data Source
Administrator found at %WINDIR%SysWOW64odbcad32.exe. For any other combinations (32-
bit apps on 32-bit operating systems and 64-bit apps on 64-bit operating systems), the required
ODBC Data Source names must be created using the Control Panel’s ODBC Data Source
Administrator.
Here is the snippet which shows why odbc data source is used:
For ENOVIA Studio Modeling Platform Rich Clients .
If this is a 3rd party application you should seek their support for proper configuration. And you should _almost never_ be converting the database on your own. The ISV typically has a supported SQL Server schema and supported data migration procedures for a cross-platform database migration.
Источник
Error message when an application uses ODBC to bind a TVP and a subtype as DAE in SQL Server 2008: «HY010, [Microsoft][SQL Server Native Client 10.0]Function sequence error»
Bug #: 50003627 (SQL Hotfix)
Microsoft distributes Microsoft SQL Server 2008 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release.
Symptoms
When an application tries to insert data into a table-valued parameter (TVP) subtype in Microsoft SQL Server 2008, the call to the SQLPutData function returns the following SQL_ERROR error message:
HY010, [Microsoft][SQL Server Native Client 10.0]Function sequence error
This problem occurs if the following conditions are true:
The application uses the SQL Server 2008 ODBC driver to bind the TVP as data-at-execution (DAE).
One of the TVP’s subtypes is also bound as DAE.
Resolution
The fix for this issue was first released in Cumulative Update 2. For more information about how to obtain this cumulative update package for SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
958186 Cumulative update package 2 for SQL Server 2008Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
956909 The SQL Server 2008 builds that were released after SQL Server 2008 was released
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.
More Information
For more information about what files are changed, and for information about any prerequisites to apply the cumulative update package that contains the hotfix that is described in this Microsoft Knowledge Base article, click the following article number to view the article in the Microsoft Knowledge Base:
958186 Cumulative update package 2 for SQL Server 2008
References
For more information about the list of builds that are available after the release of SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
956909 The SQL Server 2008 builds that were released after SQL Server 2008 was released
For more information about the Incremental Servicing Model for SQL Server, click the following article number to view the article in the Microsoft Knowledge Base:
935897 An Incremental Servicing Model is available from the SQL Server team to deliver hotfixes for reported problems
For more information about the naming schema for SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499New naming schema for Microsoft SQL Server software update packagesFor more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Источник
Лог ошибки.
INSERT INTO Delivery_statistics (Номенклатура товара, Кол-во, Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)"
QODBCResult::exec: Unable to execute statement: "[Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций"
"[Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций"
"QODBC3: Unable to execute statement"`
Код
QSqlQuery Query;
QString QueryStr = "INSERT INTO "+nameTable+" (Номенклатура товара, Кол-во, Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)";
qDebug()<<QueryStr;
Query.prepare(QueryStr);
if(!Query.exec())
{
qDebug()<<Query.lastError().databaseText();
qDebug()<<Query.lastError().driverText();
}
Arhadthedev
11.4k8 золотых знаков42 серебряных знака69 бронзовых знаков
задан 24 мая 2017 в 19:09
Если это Access, попробуйте так:
QString QueryStr = "INSERT INTO "+nameTable+" ([Номенклатура товара], [Кол-во], Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)";
ответ дан 24 мая 2017 в 19:40
msimsi
11.4k15 серебряных знаков16 бронзовых знаков
5
Последний параметр должен быть в кавычках
ответ дан 24 мая 2017 в 19:39
dkfancskadkfancska
1191 серебряный знак5 бронзовых знаков
1
I’ve been tasked with a one time migration from a 4D database to our MSSQL structure. I’ve got a datasource set up in the ODBC administrator and I was able to connect to it without issues.
I ‘reverse engineered’ the schema in Visio so I can get a good visual of the relationships between the tables and plan out how I’m going to re-structure the 4D data to fit into our schema. I created a simple console application as this will be a one time run, and I’m able to make the connection to the data source, but as soon as I execute anything, the connection drops or is disabled.
System.Data.Odbc.OdbcConnection conn =
new System.Data.Odbc.OdbcConnection("Dsn=4D v12 datasource");
try
{
conn.Open();
Console.WriteLine("Status of Connection:" + conn.State.ToString());
//Here it says the connection to the DB is open and ready for action
Console.ReadLine();
//pause to visually confirm the connection is open
OdbcCommand com = new OdbcCommand("SELECT * FROM ATable", conn);
com.CommandType = CommandType.Text;
Console.Write(com.ExecuteNonQuery());
//Right here it blows up and closes the connection
}
I also tried to do something with data set and data adapter, but to no avail.
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection("Dsn=4D v12 datasource");
try
{
conn.Open();
Console.WriteLine("Status of Connection:" + conn.State.ToString());
Console.ReadLine();
OdbcCommand com = new OdbcCommand("SELECT * FROM ATable", conn);
com.CommandType = CommandType.Text;
//Also tried using data sets and data adapters
DataSet dsTest = new DataSet();
OdbcDataAdapter dataAdapter = new OdbcDataAdapter(com);
//but right at this line the connection suddenly disconnects
dataAdapter.Fill(dsTest);
}
catch (Exception e)
{
Console.WriteLine("Failure:" + e.Message.ToString());
// the exception message reads simply connection has been disabled.
Console.WriteLine("Status of Connection: " + conn.State.ToString());
Console.ReadLine();
}
finally
{
Console.Write("Closing connection.");
conn.Close();
Console.Write(".");
conn.Dispose();
Console.WriteLine(".");
Console.WriteLine("Connection Closed and Disposed");
Console.ReadLine();
}
I’ve tried to look for anyone experiencing this same difficulty, but the documentation I’ve found has been scarce and not very helpful in this specific regard. There is a good amount of information about executing queries on the 4D product, but not from across the digital divide. Anyone with experience please advise. Thanks for your time and for any help you may be able to give, avid reader.
Перейти к контенту
Лог ошибки.
INSERT INTO Delivery_statistics (Номенклатура товара, Кол-во, Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)"
QODBCResult::exec: Unable to execute statement: "[Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций"
"[Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций"
"QODBC3: Unable to execute statement"`
Код
QSqlQuery Query;
QString QueryStr = "INSERT INTO "+nameTable+" (Номенклатура товара, Кол-во, Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)";
qDebug()<<QueryStr;
Query.prepare(QueryStr);
if(!Query.exec())
{
qDebug()<<Query.lastError().databaseText();
qDebug()<<Query.lastError().driverText();
}
Arhadthedev
11.4k8 золотых знаков39 серебряных знаков69 бронзовых знаков
задан 24 мая 2017 в 19:09
Если это Access, попробуйте так:
QString QueryStr = "INSERT INTO "+nameTable+" ([Номенклатура товара], [Кол-во], Цена,Дата) VALUES('Карандаш', 111, 15,#01/01/2017#)";
ответ дан 24 мая 2017 в 19:40
msimsi
11.4k15 серебряных знаков16 бронзовых знаков
5
Последний параметр должен быть в кавычках
ответ дан 24 мая 2017 в 19:39
dkfancskadkfancska
1191 серебряный знак5 бронзовых знаков
1
Прямой SQL, ошибка HY010
Модераторы: m0p3e, edward_K, Модераторы
Прямой SQL, ошибка HY010
Салют!
Пытаюсь освоить прямой SQL. Запускаю запрос, собранный операторами sqlAddStr, однако при этом в ms70drv.log выбрасывается
- Код: Выделить всё
30.06.2010 15:52:54 [USER]:
<текст запроса>
30.06.2010 15:52:54 [USER]:
Ошибка(1,0): Ожидался SQL оператор
30.06.2010 15:52:54 [USER]:
HY010: [Microsoft][─шёяхЄўхЁ фЁрщтхЁют ODBC] ╬°шсър яюёыхфютрЄхы№эюёЄш ЇєэъЎшщ
причём именно так, с разной кодировкой последних строк (для тех, кто не понял: последняя строка расшифровывается как «HY010: [Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций»). Сам <текст запроса>, скопированный в Query Analyzer, выполняется. Что бы это значило?
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Re: Прямой SQL, ошибка HY010
Masygreen » Пт июл 02, 2010 15:49
Собственно логичнее выкладывать код который приводит к ошибкам, а не ошибки ….
Время ведет!
- Masygreen
- Местный житель
- Сообщения: 1089
- Зарегистрирован: Чт сен 04, 2008 11:27
- Откуда: Москва
- Reputation point: 26
-
- Сайт
- ICQ
Re: Прямой SQL, ошибка HY010
RAJAH » Пт июл 02, 2010 16:56
Мне показалось, что дело не в коде, ведь запрос, собранный им, нормально отрабатывает в Query Analyzer. К тому же он весьма громоздок, и я не хотел бы тратить время уважаемых пользователей на анализ сотен строк кода. Вот если бы мне подсказали о природе этих ошибок, я бы поискал фрагмент, отвечающий за это безобразие, и постарался бы его выложить. Если вы настаиваете на том, что причина вышеприведенной ошибки в коде, а не в запросе, приведу и его.
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Re: Прямой SQL, ошибка HY010
RAJAH » Пн июл 05, 2010 12:02
Я так понял, пока не приведу код, никто не ответит? Ладно, сами напросились… Под <текст запроса> скрывается это:
- Код: Выделить всё
declare @hdrpsnrec binary(8)
declare @canvalnrec binary(8)
set @hdrpsnrec=0x8001000000002C71
declare @pbigint bigint
set @pbigint=convert(bigint, 0x80010000000002E5)
set @hdrpsnrec=convert(binary(8),@pbigint)
set @pbigint=convert(bigint,0x8000000000000000)
set @pbigint=convert(bigint, 0x8001000000000599)
set @canvalnrec=convert(binary(8),@pbigint)
declare @stackid int
set @stackid=0
declare @spstack table
(id int IDENTITY(0,1) primary key,
sid int,
param1 int
)
declare @tident int
declare @sptable1 table
(id int IDENTITY(0,1) primary key,
level int,
strindex varchar(255),
strindex2 varchar(255),
pslinesnrec binary(8),
pslinescdet binary(8),
hdrpscdetnrec binary(8),
katmcobozn varchar(50),
katmcname varchar(200),
pslinesced binary(8),
barkod varchar(20),
okp varchar(20),
pslinescpodr binary(8),
pslinesceh binary(8),
izgot binary(8),
izgots int,
edizm varchar(20),
edkoef real,
alt_edizm varchar(20),
vesid real,
rashnaed real,
kol real,
alt_koef real,
rashnaizd real,
sklad varchar(20),
ceh varchar(20),
izgotc varchar(20),
marshrut varchar(100),
dm varchar(20),
dl varchar(20),
shr varchar(20),
tol varchar(20),
razmer varchar(50),
tz varchar(50),
katmcorder int,
idce int,
typemainowner int,
idmainowner int,
KD varchar(20)
)
declare @level as int
set @level=0
insert @sptable1 (level, pslinescdet, katmcname, katmcobozn, barkod, okp,vesid,
edizm,
strindex,katmcorder,
idce,typemainowner,
izgot,izgots,
kol,rashnaed, edkoef)
select @level 'level', hdr_ps.f$cizd pslinescdet, katmc.f$name, katmc.f$obozn, katmc.f$barkod,katmc.f$okdp,katmc.f$massa,
case when hdr_ps.f$ced=0x8000000000000000 then kated.f$abbr else katotped.f$abbr end,
'',2,
0,2,
hdr_ps.f$cpodr,hdr_ps.f$wpodr,
hdr_ps.f$ednorm,1,
case when hdr_ps.f$ced=0x8000000000000000 then 1 else katotped.f$koef end
from t$hdr_ps hdr_ps
inner join t$katmc katmc
on hdr_ps.f$cizd=katmc.f$nrec
inner join t$kated kated
on katmc.f$ced=kated.f$nrec
left join t$katotped katotped
on hdr_ps.f$ced=katotped.f$nrec
where @hdrpsnrec=hdr_ps.f$nrec
while (((select count(*) from @sptable1 sptable1 where @level=sptable1.level)>0) and (@level<100))
begin
set @level=@level+1
insert @sptable1 ( level, strindex, pslinesnrec,
pslinescdet, katmcorder,katmcname, katmcobozn,
idce,
typemainowner,
idmainowner,
pslinescpodr, pslinesceh, izgot,izgots, pslinesced,
barkod,okp,vesid,
rashnaed,
kol)
select @level 'level',sptable1.strindex+str(sptable1.id,4)'|', ps_lines.f$nrec pslinesnrec,
ps_lines.f$cdet pslinescdet,typemc.f$order,katmc.f$name,katmc.f$obozn,
case when sptable1.katmcorder=2 then sptable1.id else sptable1.idce end,
case when (typemc.f$order=2) or (typemc.f$order=3) then typemc.f$order else sptable1.typemainowner end,
case when (typemc.f$order=2) or (typemc.f$order=3) then null else case when (sptable1.idmainowner is null) then sptable1.id else sptable1.idmainowner end end,
ps_lines.f$cpodr,ps_lines.f$canval1,
isnull(hdr_psvar.f$cpodr,hdr_ps.f$cpodr),isnull(hdr_psvar.f$wpodr,hdr_ps.f$cpodr),
ps_lines.f$ced,
katmc.f$barkod,katmc.f$okdp,katmc.f$massa,
ps_lines.f$kol,
sptable1.kol*ps_lines.f$kol
from @sptable1 sptable1
inner join t$hdr_ps hdr_ps
on 4=hdr_ps.f$ctypeizd and sptable1.pslinescdet = hdr_ps.f$cizd and 25=hdr_ps.f$kind and 1=hdr_ps.f$active
left join t$hdr_ps hdr_psvar
on 4=hdr_psvar.f$ctypeizd and sptable1.pslinescdet = hdr_psvar.f$cizd and 25=hdr_psvar.f$kind and @canvalnrec=hdr_psvar.f$canval1
inner join t$ps_lines ps_lines
on isnull(hdr_psvar.f$nrec,hdr_ps.f$nrec)=ps_lines.f$chdr
inner join t$katmc katmc
on ps_lines.f$cdet=katmc.f$nrec
inner join t$typemc typemc
on katmc.f$ctype=typemc.f$nrec
where @level-1=sptable1.level
order by typemc.f$order, katmc.f$obozn, katmc.f$name
end
update @sptable1 set strindex2=strindex+str(id,4)+'|', idmainowner=isnull(idmainowner,id)
update @Sptable1 set hdrpscdetnrec=isnull(hdr_psvar.f$nrec,hdr_ps.f$nrec),izgotc=case when isnull(hdr_psvar.f$wpodr,hdr_ps.f$wpodr)=2 then isnull(pizgot.f$kod,'') else '**' end
from @Sptable1 sptable1
inner join t$hdr_ps hdr_ps
on 4=hdr_ps.f$ctypeizd and sptable1.pslinescdet = hdr_ps.f$cizd and 25=hdr_ps.f$kind and 1=hdr_ps.f$active
left join t$hdr_ps hdr_psvar
on 4=hdr_psvar.f$ctypeizd and sptable1.pslinescdet = hdr_psvar.f$cizd and 25=hdr_psvar.f$kind and @canvalnrec=hdr_psvar.f$canval1
left join t$katpodr pizgot
on isnull(hdr_psvar.f$cpodr,hdr_ps.f$cpodr)=pizgot.f$nrec
update @Sptable1 set sklad=isnull(psklad.f$kod,''),ceh=isnull(pceh.f$kod,''),izgotc=isnull(izgotc,''),marshrut=isnull(izgotc,''),
edizm=isnull(edizm,case when pslinesced=0x8000000000000000 then kated.f$abbr else katotped.f$abbr end),
edkoef=case when pslinesced=0x8000000000000000 then 1 else katotped.f$koef end,
alt_edizm=case when pslinesced=0x8000000000000000
then
case when
(select otped.f$akt
from t$katotped otped
where otped.f$ckated = kated.f$nrec and otped.f$cmcusl = katmc.f$nrec)=1
then
(select otped.f$abbr
from t$katotped otped
where otped.f$pr = 1 and otped.f$akt <> 1 and otped.f$cmcusl = katmc.f$nrec)
end
else
case when katotped.f$pr=1
then edizm
else
(select otped.f$abbr
from t$katotped otped
inner join t$katmc
on otped.f$cmcusl = t$katmc.f$nrec and otped.f$pr=1
where pslinescdet = otped.f$cmcusl and pslinesced <> otped.f$nrec)
end
end,
alt_koef=case when pslinesced=0x8000000000000000
then
case when
(select otped.f$akt
from t$katotped otped
where otped.f$ckated = kated.f$nrec and otped.f$cmcusl = katmc.f$nrec)=1
then
(select otped.f$koef
from t$katotped otped
where otped.f$pr = 1 and otped.f$akt <> 1 and otped.f$cmcusl = katmc.f$nrec)
end
else
case when katotped.f$pr=1
then 1
else
(select otped.f$koef
from t$katotped otped
inner join t$katmc
on otped.f$cmcusl = t$katmc.f$nrec and otped.f$pr=1
where pslinescdet = otped.f$cmcusl and pslinesced <> otped.f$nrec)
end
end,
dm=case when paramvoldlsr.f$valempty#8#=1 then convert(varchar(20),convert(float,paramvoldlsr.f$value#8#)) else '' end,
dl=case when paramvoldlsr.f$valempty#9#=1 then convert(varchar(20),convert(float,paramvoldlsr.f$value#9#)) else '' end,
shr=case when paramvoldlsr.f$valempty#10#=1 then convert(varchar(20),convert(float,paramvoldlsr.f$value#10#)) else '' end,
tol=case when paramvoltol.f$valempty#1#=1 then convert(varchar(20),convert(float,paramvoltol.f$value#1#)) else '' end,
KD=case when paramvolKD.f$valempty#5#=1 then convert(varchar(20),convert(float,paramvolKD.f$value#5#)) else '' end,
tz=isnull(spkau.f$code,'')
from @Sptable1 sptable1
inner join t$katmc katmc
on Sptable1.pslinescdet=katmc.f$nrec
left join t$kated kated
on katmc.f$ced=kated.f$nrec
left join t$katotped katotped
on sptable1.pslinesced=katotped.f$nrec
left join t$katpodr pceh
on sptable1.pslinescpodr=pceh.f$nrec
left join t$katpodr psklad
on sptable1.pslinesceh=psklad.f$nrec
left join t$paramvol paramvoldlsr
on sptable1.pslinesnrec=paramvoldlsr.f$cobject and 11053=paramvoldlsr.f$tobject and 0=paramvoldlsr.f$block
left join t$paramvol paramvoltol
on sptable1.pslinesnrec=paramvoltol.f$cobject and 11053=paramvoltol.f$tobject and 1=paramvoltol.f$block
left join t$paramvol paramvolKD
on sptable1.pslinesnrec=paramvolKD.f$cobject and 11053=paramvolKD.f$tobject and 1=paramvolKD.f$block
left join t$spkau spkau
on (paramvoldlsr.f$valempty#7#=1) and
(convert(binary(8),convert(bigint,0x8000000000000000)+convert(bigint,paramvoldlsr.f$value#7#))=spkau.f$nrec)
while (@level>0)
begin
update @sptable1 set marshrut=sptable2.marshrut+'-'+sptable1.marshrut
from @sptable1 sptable1
inner join (select * from @sptable1 where @level=level and 5>katmcorder ) sptable2
on sptable1.idmainowner=sptable2.idmainowner
where @level-1=sptable1.level and 5>sptable1.katmcorder
set @level=@level-1
end
insert @spstack (sid)
values(@stackid)
declare @strindex1 varchar(255)
declare @katmcorder int
declare @pslinesnrec binary (8)
declare @tmptable1 table
(i int IDENTITY(0,1) primary key,
strindex varchar(255),
id int,
idce int,
repr int
)
declare @tmptable2 table
(strindex varchar(255),
id int,
idce int
)
declare @startid int
declare @strindex2 varchar(255)
declare @idce int
while (Select count(*) from @spstack)>0 begin
Select @stackid=max(id) from @spstack
select @startid=sid from @spstack where (@stackid)=id
select @strindex2=strindex2,@idce=idce from @sptable1 where @startid=id
insert @tmptable1 (strindex,repr)
values ('Узел',1)
insert @tmptable1 (strindex,id,idce,repr)
values (@strindex2,@startid,@idce,1)
insert @tmptable1 (strindex,id,idce,repr)
select strindex2,id,idce,1 from @sptable1 where @startid=idce and 1=katmcorder
order by strindex2
insert @tmptable1 (strindex,repr)
values ('СЕ узла',2)
delete from @tmptable2
insert @tmptable2 (strindex,id,idce)
select strindex2,id,idce from @sptable1 where @Startid<>id and @startid=idce and 2=katmcorder
order by strindex2
insert @spstack (sid)
select id from @tmptable2
order by id desc
insert @tmptable1 (strindex,id,idce,repr)
select strindex,id,idce,2 from @tmptable2
insert @tmptable1 (strindex,repr)
values ('Детали собств. пр-ва',3)
select @tident=@@identity
insert @tmptable1 (strindex,id,idce,repr)
select strindex2,id,idce,3 from @sptable1 where @startid=idce and 3=typemainowner
order by strindex2
if @tident=@@identity delete from @tmptable1 where @tident=i
insert @tmptable1 (strindex,repr)
values ('Стандартные покупные изделия',7)
select @tident=@@identity
insert @tmptable1 (strindex,id,idce,repr)
select strindex2,id,idce,4 from @sptable1 where @startid=idce and 7=katmcorder and 2=typemainowner
order by strindex2
if @tident=@@identity delete from @tmptable1 where @tident=i
insert @tmptable1 (strindex,repr)
values ('Покупные материалы',6)
select @tident=@@identity
insert @tmptable1 (strindex,id,idce,repr)
select strindex2,id,idce,4 from @sptable1 where @startid=idce and 6=katmcorder and 2=typemainowner
order by strindex2
if @tident=@@identity delete from @tmptable1 where @tident=i
insert @tmptable1 (strindex,repr)
values ('Покупные комплектующие',5)
select @tident=@@identity
insert @tmptable1 (strindex,id,idce,repr)
select strindex2,id,idce,4 from @sptable1 where @startid=idce and 5=katmcorder and 2=typemainowner
order by strindex2
if @tident=@@identity delete from @tmptable1 where @tident=i
insert @tmptable1 (strindex,repr)
values ('-Конец узла-',1)
delete from @spstack where (@stackid)=id
end
select tmptable1.strindex,tmptable1.repr,
isnull(sptable1.katmcobozn,'<<'+tmptable1.strindex+'>>') 'katmcobozn',
case when sptable1.katmcobozn<>'' then REPLACE(replace(sptable1.katmcname, sptable1.katmcobozn,''), ' ', ' ') else sptable1.katmcname end 'katmcname',
sptable1.barkod,sptable1.okp,sptable1.edizm, sptable1.razmer, sptable1.KD, sptable1.alt_edizm 'alted',
case when sptable1.alt_edizm<>'' then sptable1.edkoef/sptable1.alt_koef else 0 end 'altkoef',
sptable1.vesid,sptable1.rashnaed,sptable1.rashnaizd,sptable1.kol,sptable1.sklad,sptable1.ceh,sptable1.izgotc,sptable1.marshrut,
sptable1.tz, sptable1.dl,sptable1.shr,sptable1.tol,sptable1.dm,
sptable1.katmcorder,sptable1.idce,sptable1.typemainowner,sptable1.idmainowner from @tmptable1 tmptable1
left join @sptable1 sptable1
on tmptable1.id=sptable1.id
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Re: Прямой SQL, ошибка HY010
edward_K » Пн июл 05, 2010 12:12
я бы вам посоветовал пойти мелкими шажками и уже привести запрос строк в 10 а не в 100.
Ошибка не галки а MSSQL. Google полно тем дает.
Попробуйте отследить что на выходе идет в MSSQL — галка ведь транслирует ваш запрос. Наверняка какие то символы были нет поняты.
- edward_K
- Заслуженный деятель интернет-сообщества
- Сообщения: 5172
- Зарегистрирован: Вт мар 29, 2005 17:49
- Откуда: SPB galaxy spb
- Reputation point: 115
Re: Прямой SQL, ошибка HY010
edward_K » Пн июл 05, 2010 12:17
вообще по коду добрая часть тянет на сторед процедуру — ее и генерить то каждый раз не нужно — один раз создали и забыли.
- edward_K
- Заслуженный деятель интернет-сообщества
- Сообщения: 5172
- Зарегистрирован: Вт мар 29, 2005 17:49
- Откуда: SPB galaxy spb
- Reputation point: 115
Re: Прямой SQL, ошибка HY010
RAJAH » Пн июл 05, 2010 12:26
edward_K писал(а):Наверняка какие то символы были нет поняты.
Какие символы вы имеете в виду? NULL? Есть такое. Нельзя, что ли?
edward_K писал(а):Ошибка не галки а MSSQL.
Хм… А в чём конкретно ошибка почему MSSQL не говорит? Запрос прекрасно срабатывает в Query Analyzer.
edward_K писал(а):вообще по коду добрая часть тянет на сторед процедуру — ее и генерить то каждый раз не нужно — один раз создали и забыли.
К стыду своему, про Stored Procedure только слышал, сам не сталкивался. Придётся изучить на досуге…
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Re: Прямой SQL, ошибка HY010
Den » Пн июл 05, 2010 13:07
Ошибка это не мсскуль, видимо
В ms70,как я понимаю , делает сама галактика ,когда пытается проверить отдаваемый запрос на синтаксис правильный,исходя из продекларированных возможностей dsql. Ведь профайлер, Раджа, ничего не кажет ?
- Den
- Местный житель
- Сообщения: 1839
- Зарегистрирован: Вт мар 29, 2005 17:49
- Откуда: Ярославская область ОАО «Часовой завод Чайка» г. Углич
- Reputation point: 60
-
- ICQ
Re: Прямой SQL, ошибка HY010
Vik » Пн июл 05, 2010 13:15
Ошибка последовательности функций обычно говорит о том, что вы не правильно используете функции доступа к прямому SQL.
- Vik
- Местный житель
- Сообщения: 370
- Зарегистрирован: Чт сен 28, 2006 15:43
- Откуда: Санкт-Петербург
- Reputation point: 26
-
- Сайт
- ICQ
Re: Прямой SQL, ошибка HY010
RAJAH » Пн июл 05, 2010 13:18
Чувствую себя немного ущербным: то хранимые процедуры, то профайлер… Вы слишком умны для меня. Что такое профайлер?
Den, а вы не тот den, у кого здесь http://forum.galaktika.ru/viewtopic.php?f=10&t=394&start=0 была та же ошибка? Чем вылечили?
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Re: Прямой SQL, ошибка HY010
Den » Пн июл 05, 2010 13:43
Угу…это я
Тогад разработчики предложили использовать COALESCE. Вроде с ним должно работать. Я уж как то тогда локально проблемы решил пока ждал ответа разработчиков — поэтому попробуйте с ним сами.
Profiler — утилита MSSQL. С ее помощью можно просто посмотреть какой запрос собранный приходит от атлантиса…
- Den
- Местный житель
- Сообщения: 1839
- Зарегистрирован: Вт мар 29, 2005 17:49
- Откуда: Ярославская область ОАО «Часовой завод Чайка» г. Углич
- Reputation point: 60
-
- ICQ
Re: Прямой SQL, ошибка HY010
RAJAH » Пн июл 05, 2010 16:55
Den писал(а):Угу…это я
Тогад разработчики предложили использовать COALESCE. Вроде с ним должно работать.
Использовать COALESCE вместо ISNULL?
P.S. Profiler так сказал:
- Код: Выделить всё
Replay server: BRAIN
Total events = 1
Replayed events = 1
ODBC errors = 0
Internal errors = 1
Total errors = 1
ODBC hit ratio = 100,00 %
Internal hit ratio = 0,00 %
Overall hit ratio = 0,00 %
Replay time = 0 hr 0 min 5 sec 328 ms
Что, интересно, означает «внутренняя ошибка»?
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Re: Прямой SQL, ошибка HY010
Vik » Пн июл 05, 2010 17:49
Непонятно немного, вы весь код, что привели выше, пытаетесь выполнить из випа при помощи функционала DSQL? Если да, то как-то это неправильно. edward_K вам правильно сказал — это больше на кандидата в хранимку похоже. Сомневаюсь, что многое из того, что у вас написано будет работать без оформления в виде хранимки. И еще раз, повторюсь, хотя может быть это и не тот случай, но сколько бы раз у меня ни была ошибка последовательности функций, всегда это была моя ошибка — не в том порядке или неправильно использовал функции DSQL.
- Vik
- Местный житель
- Сообщения: 370
- Зарегистрирован: Чт сен 28, 2006 15:43
- Откуда: Санкт-Петербург
- Reputation point: 26
-
- Сайт
- ICQ
Re: Прямой SQL, ошибка HY010
Den » Пн июл 05, 2010 18:24
Что же вы тогда собираете с помощью «..собранный операторами sqlAddStr…» (смотрю первое Ваше сообщение). То что Вы привели — это код на TSQL чистом
Ну да…isnull просто нет в DSQl. Будите огребать ошибку
- Den
- Местный житель
- Сообщения: 1839
- Зарегистрирован: Вт мар 29, 2005 17:49
- Откуда: Ярославская область ОАО «Часовой завод Чайка» г. Углич
- Reputation point: 60
-
- ICQ
Re: Прямой SQL, ошибка HY010
RAJAH » Пн июл 05, 2010 22:48
Vik писал(а):Непонятно немного, вы весь код, что привели выше, пытаетесь выполнить из випа при помощи функционала DSQL?
Я же написал, что этот код из ms70drv.log, «..собранный операторами sqlAddStr…»
- Код: Выделить всё
sqlAddStr(qhandle,'declare @hdrpsnrec binary(8)');
sqlAddStr(qhandle,'declare @canvalnrec binary(8)');
sqlAddStr(qhandle,'set @hdrpsnrec=0x8001000000002C71');
sqlAddStr(qhandle,'declare @pbigint bigint');
sqlAddStr(qhandle,'set @pbigint=convert(bigint, '+nrhdr_QA+')');
...
sqlAddStr(qhandle,'sptable1.vesid,sptable1.rashnaed,sptable1.rashnaizd,sptable1.kol,sptable1.sklad,sptable1.ceh,sptable1.izgotc,sptable1.marshrut,');
sqlAddStr(qhandle,'sptable1.tz, sptable1.dl,sptable1.shr,sptable1.tol,sptable1.dm,');
sqlAddStr(qhandle,'sptable1.katmcorder,sptable1.idce,sptable1.typemainowner,sptable1.idmainowner from @tmptable1 tmptable1');
sqlAddStr(qhandle,'left join @sptable1 sptable1');
sqlAddStr(qhandle,'on tmptable1.id=sptable1.id');
Vik писал(а):Сомневаюсь, что многое из того, что у вас написано будет работать без оформления в виде хранимки.
Опять же: выше уже указано, что в Query Analyzer всё работает.
Den писал(а):isnull просто нет в DSQl
Видимо, в этом всё дело… Интересно, документация, где это всё написано, существует?
Последний раз редактировалось RAJAH Вт июл 06, 2010 11:05, всего редактировалось 1 раз.
- RAJAH
- Местный житель
- Сообщения: 929
- Зарегистрирован: Пн фев 18, 2008 13:49
- Reputation point: 57
Вернуться в Программирование
Кто сейчас на конференции
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 2
Я искал SO и Google, но не нашел большой помощи по этому вопросу. Кажется, из-за того, что функции ODBC вызываются не по порядку. Но так как я использую QSql, который оборачивает ODBC, мне трудно отследить функцию. Пожалуйста помоги…
- Мне удалось подключиться к базе данных сервера SQL
- Я проверил очень простой запрос и все еще получил ошибку. Я не думаю, что это связано с привязкой столбцов.
-
Я был в состоянии выполнить запрос с SQL Server, поэтому я думаю, что SQL-запрос в порядке.
- Инструменты, которые я использую:
VS c ++ 2017, CMake, Qt 5.09.2, sql server 2017
-
Ниже приведены сообщения об ошибках:
QODBCResult :: exec: Невозможно выполнить оператор: «[Microsoft] [Диспетчер драйверов ODBC] Ошибка последовательности функций» QSqlError («0», «QODBC3: Невозможно выполнить оператор», «[Microsoft] [Диспетчер драйверов ODBC] Ошибка последовательности функций «)
-
Тестовое кодирование:
Эта кодировка генерирует сообщение об ошибке выше.
int main()
{
QSqlDatabase GUIInpDB = QSqlDatabase::addDatabase("QODBC", "MainSQLDB");
GUIInpDB.setConnectOptions();
QString inpSqlServer = "DESKTOP-085AEA8SQLEXPRESS";
QString dbName = "test";
QString connString = QString("Driver={ODBC Driver 13 for SQL Server};Server=%1;DATABASE=%2;Trusted_Connection=Yes;")
.arg(inpSqlServer).arg(dbName); //the argument replace the %1 and %2
GUIInpDB.setDatabaseName(connString);
QSqlDatabase db = QSqlDatabase::database("MainSQLDB");
if (!db.open())
{
qDebug() << "Connection for db not working";
return 1;
}
QSqlQuery query("SELECT * FROM TBL.tbl_test", db);
if (!query.exec())
qDebug() << query.lastError();
int num_of_rows = query.size();
getchar();
return 0;
}
0
Решение
Другие решения
Других решений пока нет …
- Remove From My Forums
-
Question
-
Hi
While connecting to SQL Server from 64 bit OS and 64 bit version of my program and running the following statement i am getting ODBC Driver Manager throws function sequence Error
rc = SQLSetStmtAttr( *pStmtSQLHandle, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN, 0);
But the same functionality works fine when connected from 32 bit OS with 32 bit version of my program
I am connecting to SQL Server 2008
64 bit ODBC Driver gives this error where as 32 bit ODBC driver works fine
any clues/pointer
from
nayeem khan
Khan
Answers
-
For setting SQL_ATTR_ROW_BIND_TYPE, please set the 4th argument as the constant SQL_IS_UINTEGER.
But I don’t think that this is the root cause of the issue. Since the error message is about «function sequence error», please pay special attention if you are using DAE parameter or ASYNC functionality. Please double-check the return code of previously-called functions carefully.
If the issue can be reproduced easily, please try to capture us a ODBC Trace log or BidTrace log. You can see the detail instruction on MSDN.
I wonder what the OS of the 32-bit OS is, and what is your new OS? Win7?Thanks,
Ming.
WDAC Team, Microsoft.
Pak-Ming Cheung — MSFT
- Edited by
Thursday, March 11, 2010 3:28 PM
update - Marked as answer by
Pak-Ming CheungEditor
Thursday, July 22, 2010 5:25 PM
- Edited by
- Remove From My Forums
-
Question
-
Hi
While connecting to SQL Server from 64 bit OS and 64 bit version of my program and running the following statement i am getting ODBC Driver Manager throws function sequence Error
rc = SQLSetStmtAttr( *pStmtSQLHandle, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN, 0);
But the same functionality works fine when connected from 32 bit OS with 32 bit version of my program
I am connecting to SQL Server 2008
64 bit ODBC Driver gives this error where as 32 bit ODBC driver works fine
any clues/pointer
from
nayeem khan
Khan
Answers
-
For setting SQL_ATTR_ROW_BIND_TYPE, please set the 4th argument as the constant SQL_IS_UINTEGER.
But I don’t think that this is the root cause of the issue. Since the error message is about «function sequence error», please pay special attention if you are using DAE parameter or ASYNC functionality. Please double-check the return code of previously-called functions carefully.
If the issue can be reproduced easily, please try to capture us a ODBC Trace log or BidTrace log. You can see the detail instruction on MSDN.
I wonder what the OS of the 32-bit OS is, and what is your new OS? Win7?Thanks,
Ming.
WDAC Team, Microsoft.
Pak-Ming Cheung — MSFT
- Edited by
Thursday, March 11, 2010 3:28 PM
update - Marked as answer by
Pak-Ming CheungEditor
Thursday, July 22, 2010 5:25 PM
- Edited by
#python #sql #azure
Вопрос:
def gotorasp1(self):
with pyodbc.connect(
'DRIVER=' driver ';SERVER=' server ';PORT=1433;DATABASE=' database ';UID=' username ';PWD=' password) as coca:
with coca.cursor() as cola:
cola.execute("SELECT * FROM Data")
mac = cola.fetchone()
log = self.login.text()
pas = self.passw.text()
ind = 0
check = 0
while ind != 5:
if log == mac.Login:
if pas == mac.Password:
un = mac.Lname
check = check 1
mac = cola.fetchone()
ind = ind 1
if check == 1:
self.username_labl_11.setText(_translate("MainWindow", un))
self.login.setText("")
self.passw.setText("")
MainWindow.setMinimumSize(QtCore.QSize(1180, 800))
MainWindow.setMaximumSize(QtCore.QSize(16777215, 16777215))
desktop = QtWidgets.QApplication.desktop()
x = (desktop.width() - MainWindow.width()) // 2
y = (desktop.height() - MainWindow.height() - 90) // 2
MainWindow.move(x, y)
self.label_8.setStyleSheet("font: 9pt "Montserrat";n""color:white")
self.stackedWidget1.setCurrentWidget(self.page_2)
self.comboBox.setItemText(0, _translate("MainWindow", dw " " today.strftime("%d.%m.%Y")))
cursor.execute(f"SELECT * FROM [dbo].[September] WHERE Day = {t}")
row = cursor.fetchone()
...
Эта ошибка появляется в этой строке:
mac = cola.fetchone()
И я,как человек, не особо разбирающийся в теме, совершенно не могу понять, почему.
Я буду очень благодарен за любые ответы.
Ответ №1:
Мне нравится просто хватать все вещи сразу и заносить их в список. Мне также нравится захватывать определения столбцов, поскольку это часто необходимо.
column_definition = cola.description
rows = cola.fetchall()
Затем зацикливайтесь на строках, чтобы делать то, что вы хотите, похоже, что ваш код зацикливается на первых 4 строках, чтобы увидеть, есть ли одно совпадение. В любом случае вам нужно будет изменить эту логику, если это избавит вас от ошибки последовательности.
Комментарии:
1. Оказалось,что проблема была в том, что я тупо сломал вкладку в одном месте, но все равно спасибо!
вот txd DCT:
Код: Выделить всё
!Name(MSSQL,'NK_Goods','NK_Goods'),DATA(MAV)
SQL_Goods FILE,DRIVER('ODBC'),PRE(SQL_Goods),BINDABLE,THREAD
!!> IDENT(63),USAGE(File)
NK_Goods_pk KEY(SQL_Goods:GoodsID),OPT,PRIMARY
!!> IDENT(279)
NK_Goods_idx_Name KEY(SQL_Goods:GoodsName),NOCASE,OPT
!!> IDENT(689)
Record RECORD
[SCREENCONTROLS]
! PROMPT('Goods ID:'),USE(?SQL_Goods:GoodsID:Prompt)
! ENTRY(@n-14),USE(SQL_Goods:GoodsID),REQ,READONLY
[REPORTCONTROLS]
! STRING(@n-14),USE(SQL_Goods:GoodsID)
GoodsID LONG
!!> IDENT(1043),VALID(NONZERO),INITIAL('SELECT @@IDENTITY'),PROMPT('Goods ID:'),HEADER('Goods ID'),PICTURE(@n-14),READONLY
[SCREENCONTROLS]
! PROMPT('Goods Name:'),USE(?SQL_Goods:GoodsName:Prompt)
! ENTRY(@s50),USE(SQL_Goods:GoodsName),REQ
[REPORTCONTROLS]
! STRING(@s50),USE(SQL_Goods:GoodsName)
GoodsName STRING(50)
!!> IDENT(1045),VALID(NONZERO),PROMPT('Goods Name:'),HEADER('Goods Name'),PICTURE(@s50)
[SCREENCONTROLS]
! PROMPT('Sale Price:'),USE(?SQL_Goods:SalePrice:Prompt)
! ENTRY(@n-21.2),USE(SQL_Goods:SalePrice)
[REPORTCONTROLS]
! STRING(@n-21.2),USE(SQL_Goods:SalePrice)
SalePrice DECIMAL(15,2)
!!> IDENT(1047),PROMPT('Sale Price:'),HEADER('Sale Price'),PICTURE(@n-21.2)
[SCREENCONTROLS]
! PROMPT('Guarantee:'),USE(?SQL_Goods:Guarantee:Prompt)
! ENTRY(@n-14),USE(SQL_Goods:Guarantee)
[REPORTCONTROLS]
! STRING(@n-14),USE(SQL_Goods:Guarantee)
Guarantee LONG
!!> IDENT(1049),PROMPT('Guarantee:'),HEADER('Guarantee'),PICTURE(@n-14)
[SCREENCONTROLS]
! PROMPT('Group ID:'),USE(?SQL_Goods:GroupID:Prompt)
! ENTRY(@n-14),USE(SQL_Goods:GroupID)
[REPORTCONTROLS]
! STRING(@n-14),USE(SQL_Goods:GroupID)
GroupID LONG
!!> IDENT(1051),PROMPT('Group ID:'),HEADER('Group ID'),PICTURE(@n-14)
[SCREENCONTROLS]
! PROMPT('Info:'),USE(?SQL_Goods:Info:Prompt)
! ENTRY(@s100),USE(SQL_Goods:Info)
[REPORTCONTROLS]
! STRING(@s100),USE(SQL_Goods:Info)
Info STRING(100)
!!> IDENT(1053),PROMPT('Info:'),HEADER('Info'),PICTURE(@s100)
[SCREENCONTROLS]
! PROMPT('Goods Type:'),USE(?SQL_Goods:GoodsType:Prompt)
! ENTRY(@n3),USE(SQL_Goods:GoodsType)
[REPORTCONTROLS]
! STRING(@n3),USE(SQL_Goods:GoodsType)
GoodsType BYTE
!!> IDENT(1055),PROMPT('Goods Type:'),HEADER('Goods Type'),PICTURE(@n3)
END
END
и скрипт на сервере:
Код: Выделить всё
CREATE TABLE [dbo].[NK_Goods] (
[GoodsID] int IDENTITY(1, 1) NOT NULL,
[GoodsName] char(50) COLLATE Cyrillic_General_CI_AS NOT NULL,
[SalePrice] numeric(15, 2),
[Guarantee] int,
[GroupID] int,
[Info] char(100) COLLATE Cyrillic_General_CI_AS,
[GoodsType] tinyint,
CONSTRAINT [NK_Goods_idx_Name] UNIQUE ([GoodsName]),
CONSTRAINT [NK_Goods_pk] PRIMARY KEY NONCLUSTERED ([GoodsID])
)
ON [PRIMARY]
в словаре в опциях таблицы есть переменная NAME = ‘MSSQL,’NK_Goods’,’NK_Goods»
|
|||
Irina3gger
04.07.17 — 10:41 |
Доброго времени. Возникла такая проблема, В справочнике создала новый реквизит, но при сохранение выдает ошибку: SQL State:HY010 Native:0 Message:[Microsoft][ODBC SQL Server Driver] Ошибка последовательности функций Файлы sqlsrv32.dll sqlsrv32.rll odbcbcp.dll были заменены еще при установке SQL Server Подскажите в чем еще может быть проблема? |
||
Ёпрст
1 — 04.07.17 — 10:42 |
(0) только в этом |
||
Ёпрст
2 — 04.07.17 — 10:44 |
Если что, новый реквизит добавьте ручоками. В табличку скуля через альтер, и потом просто подмените мд и ддс. Усё |
||
Irina3gger
3 — 04.07.17 — 10:49 |
(2) Можете пожалуйста повторить еще раз что сделать? А то я не очень поняла |
||
Ёпрст
4 — 04.07.17 — 10:52 |
(3) 1. на пустой базе получить новый мд и ддс с добавленным реквизитом, 2.в рабочей базе через alter table добавить этот реквизит в соответствующую табличку справочника. 3. Далее, подменить мд и ддс в рабочей на те, что получены в п.1. 4. Наслаждаться, кушать печенки https://msdn.microsoft.com/ru-ru/library/ms190273(SQL.90).aspx |
||
Ёпрст
5 — 04.07.17 — 10:53 |
Альтернативный вариант 1.Поставить скуль, НЕ меняя никакие библиотеки в нём. 2.Поставить секретный релиз платформы 1с 3.Наслаждаться, кушать печенки |
||
Builder
6 — 04.07.17 — 10:56 |
(5) Это самый правильный вариант. Секретный 7.7 + SQL 2008 работает стабильно. |
||
Irina3gger
7 — 04.07.17 — 10:57 |
Спасибо большое буду пробовать. |
||
Slypower 8 — 05.07.17 — 09:51 |
Или поставить ХР, на ней данная ошибка не будет проявляться. |
ВНИМАНИЕ! Если вы потеряли окно ввода сообщения, нажмите Ctrl-F5 или Ctrl-R или кнопку «Обновить» в браузере.
Тема не обновлялась длительное время, и была помечена как архивная. Добавление сообщений невозможно.
Но вы можете создать новую ветку и вам обязательно ответят!
Каждый час на Волшебном форуме бывает более 2000 человек.
Я искал SO и Google, но не нашел большой помощи по этому вопросу. Кажется, из-за того, что функции ODBC вызываются не по порядку. Но так как я использую QSql, который оборачивает ODBC, мне трудно отследить функцию. Пожалуйста помоги…
- Мне удалось подключиться к базе данных сервера SQL
- Я проверил очень простой запрос и все еще получил ошибку. Я не думаю, что это связано с привязкой столбцов.
-
Я был в состоянии выполнить запрос с SQL Server, поэтому я думаю, что SQL-запрос в порядке.
- Инструменты, которые я использую:
VS c ++ 2017, CMake, Qt 5.09.2, sql server 2017
-
Ниже приведены сообщения об ошибках:
QODBCResult :: exec: Невозможно выполнить оператор: «[Microsoft] [Диспетчер драйверов ODBC] Ошибка последовательности функций» QSqlError («0», «QODBC3: Невозможно выполнить оператор», «[Microsoft] [Диспетчер драйверов ODBC] Ошибка последовательности функций «)
-
Тестовое кодирование:
Эта кодировка генерирует сообщение об ошибке выше.
int main()
{
QSqlDatabase GUIInpDB = QSqlDatabase::addDatabase("QODBC", "MainSQLDB");
GUIInpDB.setConnectOptions();
QString inpSqlServer = "DESKTOP-085AEA8\SQLEXPRESS";
QString dbName = "test";
QString connString = QString("Driver={ODBC Driver 13 for SQL Server};Server=%1;DATABASE=%2;Trusted_Connection=Yes;")
.arg(inpSqlServer).arg(dbName); //the argument replace the %1 and %2
GUIInpDB.setDatabaseName(connString);
QSqlDatabase db = QSqlDatabase::database("MainSQLDB");
if (!db.open())
{
qDebug() << "Connection for db not working";
return 1;
}
QSqlQuery query("SELECT * FROM TBL.tbl_test", db);
if (!query.exec())
qDebug() << query.lastError();
int num_of_rows = query.size();
getchar();
return 0;
}
0
Решение
Другие решения
Других решений пока нет …
вот txd DCT:
Код: Выделить всё
!Name(MSSQL,'NK_Goods','NK_Goods'),DATA(MAV)
SQL_Goods FILE,DRIVER('ODBC'),PRE(SQL_Goods),BINDABLE,THREAD
!!> IDENT(63),USAGE(File)
NK_Goods_pk KEY(SQL_Goods:GoodsID),OPT,PRIMARY
!!> IDENT(279)
NK_Goods_idx_Name KEY(SQL_Goods:GoodsName),NOCASE,OPT
!!> IDENT(689)
Record RECORD
[SCREENCONTROLS]
! PROMPT('Goods ID:'),USE(?SQL_Goods:GoodsID:Prompt)
! ENTRY(@n-14),USE(SQL_Goods:GoodsID),REQ,READONLY
[REPORTCONTROLS]
! STRING(@n-14),USE(SQL_Goods:GoodsID)
GoodsID LONG
!!> IDENT(1043),VALID(NONZERO),INITIAL('SELECT @@IDENTITY'),PROMPT('Goods ID:'),HEADER('Goods ID'),PICTURE(@n-14),READONLY
[SCREENCONTROLS]
! PROMPT('Goods Name:'),USE(?SQL_Goods:GoodsName:Prompt)
! ENTRY(@s50),USE(SQL_Goods:GoodsName),REQ
[REPORTCONTROLS]
! STRING(@s50),USE(SQL_Goods:GoodsName)
GoodsName STRING(50)
!!> IDENT(1045),VALID(NONZERO),PROMPT('Goods Name:'),HEADER('Goods Name'),PICTURE(@s50)
[SCREENCONTROLS]
! PROMPT('Sale Price:'),USE(?SQL_Goods:SalePrice:Prompt)
! ENTRY(@n-21.2),USE(SQL_Goods:SalePrice)
[REPORTCONTROLS]
! STRING(@n-21.2),USE(SQL_Goods:SalePrice)
SalePrice DECIMAL(15,2)
!!> IDENT(1047),PROMPT('Sale Price:'),HEADER('Sale Price'),PICTURE(@n-21.2)
[SCREENCONTROLS]
! PROMPT('Guarantee:'),USE(?SQL_Goods:Guarantee:Prompt)
! ENTRY(@n-14),USE(SQL_Goods:Guarantee)
[REPORTCONTROLS]
! STRING(@n-14),USE(SQL_Goods:Guarantee)
Guarantee LONG
!!> IDENT(1049),PROMPT('Guarantee:'),HEADER('Guarantee'),PICTURE(@n-14)
[SCREENCONTROLS]
! PROMPT('Group ID:'),USE(?SQL_Goods:GroupID:Prompt)
! ENTRY(@n-14),USE(SQL_Goods:GroupID)
[REPORTCONTROLS]
! STRING(@n-14),USE(SQL_Goods:GroupID)
GroupID LONG
!!> IDENT(1051),PROMPT('Group ID:'),HEADER('Group ID'),PICTURE(@n-14)
[SCREENCONTROLS]
! PROMPT('Info:'),USE(?SQL_Goods:Info:Prompt)
! ENTRY(@s100),USE(SQL_Goods:Info)
[REPORTCONTROLS]
! STRING(@s100),USE(SQL_Goods:Info)
Info STRING(100)
!!> IDENT(1053),PROMPT('Info:'),HEADER('Info'),PICTURE(@s100)
[SCREENCONTROLS]
! PROMPT('Goods Type:'),USE(?SQL_Goods:GoodsType:Prompt)
! ENTRY(@n3),USE(SQL_Goods:GoodsType)
[REPORTCONTROLS]
! STRING(@n3),USE(SQL_Goods:GoodsType)
GoodsType BYTE
!!> IDENT(1055),PROMPT('Goods Type:'),HEADER('Goods Type'),PICTURE(@n3)
END
END
и скрипт на сервере:
Код: Выделить всё
CREATE TABLE [dbo].[NK_Goods] (
[GoodsID] int IDENTITY(1, 1) NOT NULL,
[GoodsName] char(50) COLLATE Cyrillic_General_CI_AS NOT NULL,
[SalePrice] numeric(15, 2),
[Guarantee] int,
[GroupID] int,
[Info] char(100) COLLATE Cyrillic_General_CI_AS,
[GoodsType] tinyint,
CONSTRAINT [NK_Goods_idx_Name] UNIQUE ([GoodsName]),
CONSTRAINT [NK_Goods_pk] PRIMARY KEY NONCLUSTERED ([GoodsID])
)
ON [PRIMARY]
в словаре в опциях таблицы есть переменная NAME = ‘MSSQL,’NK_Goods’,’NK_Goods»