sqlanywhere

Python list of ints in prepared sql statement

喜欢而已 提交于 2019-12-30 22:52:17
问题 My question is somewhat the same as Python list of String to SQL IN parameter but I have a list of integers. The python code I use is: ids = [1000032, 1000048] sql = 'SELECT CompNo, CompName, CompType FROM Component WHERE DeptID IN (?)' cursor.execute(sql, [','.join(ids)]) And the Sybase database engine responds with: pyodbc.Error: ('07006', "[07006] [Sybase][ODBC Driver][SQL Anywhere]Cannot convert '1000032','1000048' to a numeric (-157) (SQLExecDirectW)") What is the correct way to do this?

SQL anywhere query error: Not enough values for host variables

左心房为你撑大大i 提交于 2019-12-24 08:31:37
问题 I am building a query using ODBC command object in .Net with multiple parameters being passed in. When executing the query against SQL Anywhere, I get the following error. (The same code works against SQL Server). [System.Data.Odbc.OdbcException] = {"ERROR [07002] [Sybase][ODBC Driver][SQL Anywhere]Not enough values for host variables"} The command object has the same number of parameters added as the place holders ('?') in the query. Following is a simple query and C# code that fails the

SQL Anywhere 11 - Check if event exists

六眼飞鱼酱① 提交于 2019-12-24 04:25:06
问题 I have an SQL script which creates a scheduled event: CREATE EVENT "Daily_1200PM" SCHEDULE "Daily_1200PM" START TIME '12:00' EVERY 24 HOURS HANDLER begin -- Blah blah, do some stuff here end; I would like to remove this event, if it exists. I know I can remove the event with the following: DROP EVENT "Daily_1200PM" But for some databases, the the event doesn't actually exist, so an error is thrown. How do I delete the event only if it exists? 回答1: if exists( select * from sys.sysevent where

SQL Anywhere 11, JZ0C0: Connection is already closed

两盒软妹~` 提交于 2019-12-23 13:38:07
问题 I develop am webservice based on apache tomcat 6.0.26, apache cxf 2.2.7, spring 3.0, hibernate 3.3 and sybase sqlanywhere 11. im using the latest JDBC Driver from SYBASE jconn.jar Version 6. The persistence layer is based on spring + hibernate dao, the connection is configured via a JNDI datasoure (META-INF directory). It seems that, during longer times of inactivity, the connection from the webservice to the database is closed. Exception: java.sql.SQLException: JZ0C0: Connection is already

Regex to match all non-digit characters which are interspersed with digits with SQL

限于喜欢 提交于 2019-12-23 05:40:08
问题 Using SQL Anywhere 16 regex (Perl 5 equivalent) I would like to match all non-digit characters in the following string: This 100 is 2 a 333 test. such that the match results in This is a test. I have a feeling this requires lookarounds but I'm not sure of the exact syntax. Some of my failed attempts: \D* matches This \D*(?=\d) matches This (\D*(?=\d*)|(?<=\d)\D*)* matches This 来源: https://stackoverflow.com/questions/36020273/regex-to-match-all-non-digit-characters-which-are-interspersed-with

How to get at the database schema of a hidden DB?

穿精又带淫゛_ 提交于 2019-12-21 04:32:22
问题 My customer is a dental practice that has bought a piece of practice management software. This software was installed on their local server, including a patient database, a schedule and all manner of medical records. Now they want me to write some utilities for them that aren't provided with their package, and for this I need the ability to query this database. I tried calling tech support of the software manufacturers (Patterson/EagleSoft), and it's difficult finding anyone who understands

How to simulate the MySQL bit_count function in Sybase SQL Anywhere?

我只是一个虾纸丫 提交于 2019-12-13 01:25:50
问题 MySQL's bit_count function is quite useful for some cases: http://dev.mysql.com/doc/refman/5.5/en/bit-functions.html#function_bit-count Now I would like to use that function in other databases, that do not support it. What's the simplest way to do it (without creating a stored function, as I do not have access to the client database on a DDL level). One pretty verbose option is this (for TINYINT data types): SELECT (my_field & 1) + (my_field & 2) >> 1 + (my_field & 4) >> 2 + (my_field & 8) >>

How to generate a list of number in SQL as it was a list of comprehension?

别等时光非礼了梦想. 提交于 2019-12-12 12:22:52
问题 In my case, using sql anywhere (sybase). Something similar to haskell. [1..100]. I don't know how to generate a random simple list of 1 up to 100. I only could do it doing: select 1 union select 2 union select 3 Google did not provide any sample, I suspect this feature does not exist. 回答1: SQL Anywhere contains an sa_rowgenerator stored procedure, which can be used for this purpose. For example: select row_num from sa_rowgenerator( 1, 100 ) returns a result set of 100 rows from 1 to 100

External “Hello World” Function in SQL Anywhere with Powerbuilder-generated DLL

浪尽此生 提交于 2019-12-12 10:05:11
问题 I created a function in PowerBuilder.NET Hello World . The project compiled as Helloworld.dll , generated in C# from the PowerBuilder utility. Inside Helloworld, I made the non-visual n_cst_helloworld . Inside the non-visual, I made the object function of_hello() . These are the issues I encountered when trying to access Helloworld.n_cst_helloworld.of_hello() in an external function on SQL Anywhere. The external function uses CLR and is called in Interactive SQL right now. Here is the script

how to call stored procedure in ruby on rails?

余生颓废 提交于 2019-12-12 09:49:53
问题 I am new to ROR. I want to call the Stored Procedure to process when I click the submit button in the VIEW. Model: ------- class Pro::DataImport < ActiveRecord::Base attr_accessible :file_name, :process_name, :updated_by, :validates end Controller: ----------------- class Pro::DataImportsController < ApplicationController before_filter :authenticate_user! layout "layouts/enr/energy_master" def index @pro_data_imports = Pro::DataImport.all end def new @pro_data_import = Pro::DataImport.new end