StackOverflow is a collaborative programming Q&A community venture
Note: The content of this blog is the opinion and thoughts of the blogger and does not necessarily represent the opinions of IDUG.
How do I get ibm_db or PyDB2 python modules to work with DB2 in Mac OS X 10.7 Lion?
I used this question/answer to install DB2 in Lion: How do I install IBM DB2 Express-C on Mac OS X 10.7 Lion?
After configuring my databases, I am able to use db2 from the command line to execute queries, but the python modules ibm_db and PyDB2 both fail to import with the following error:
How can I fix this and get ibm_db and PyDB2 to work properly with DB2 in Lion?
edit: moved answer to answers
How to get only one record for the minimum wage employee from each department? DB2
I barely just started on database languages, so I do not know anything about JOIN, PARTITION, ETC. but this is what I have so far.
What I tried:
What I want:
DB2 creating a random but unique character identifier upon row insert
I currently have a column in a DB2 table which is being passed through web calls and procedure by a character-encrypted value. It is type CHARACTER(13) with a CSSID for encryption.
This has become a huge pain to accommodate through multiple APIs but was initially intended to allow us a unique ID to use in calls that wasn't the primary key.
In DB2-400, what would be the next best thing as far as a 13 or more character string that is unique and randomly created upon insert, but doesn't require decryption (just a plain string)?
Is there a commonly-gravitated-to method for this? We aren't passing secure data, so there's no need for encryption, but we just want a randomly created and unique character
hex values with CSSID in DB2-400
I have a stored procedure where I"m passing a value (from CHARACTER(13) with CSSID 65535 and trying to return an ID by it
The procedure is:
and the parameter P_WEB_IDENTIFIER Is a CHARACTER(26) with a matching cssid. I've also tried this with it being a character 13 with same results.
When I call this:
I get back my ID, but when I call like this (as it is called in production through the web):
I get a conversion error
How can I make sure that passing only the string '0213725501A421B9A457123001' will return my ID this way?
Adding parameters to SQL select and using them in Cognos Report Studio Version 10.2.1
i'm trying to put into my select a date parameter. I'm not sure how really to do this. Right now I have fixed date value in it and now I want to have a parameter like: FromDate and ToDate.I'll be really grateful for any help.My select:
Connect and retrieve result set from DB2 Stored Procedure from Node js
I am able to find solution to connect db2 tables directly and fetch data online.Please find working code for connecting db2 Stored Procedure from Nodejs with IN and OUT parameter.
Kindly let me know if anyone have a better approach for the same.
sql query to get last 6 months of data
I am trying to get the data for the last 6 months.
This is what I have used:
and I am getting this error.
and got this error:
How to select a substring surrounded by delimiters in DB2 SQL?
I would like to select the substring between '/' delimiters.This is my sample data:
I want to get this output:
I have tried this:
Unfortunately, when the date is 13/1/1990 or 1/13/1990, it doesn't work.
How to avoid CTQ operator in DB2 Blu with substr?
I'm working with DB2 Blu, and I often have problems in my queries plan with SUBSTR as the CTQ operator is not high enough.
Here is an example :
The query plan is all right :
Now, what I really want to do is a group by the first 3 characters of annee_semaine :
And now in the query plan, the group by and union are done after the CTQ operator
I tried with left instead of substr, without success. Is there a good pratice to deal with substr in DB2 Blu ?
In others cases, I was able to directly put de substr in one column in the table, mais in this case it is not possible.
DB2 extract data between two delimiters
Here is the string I am trying to extract from:'cn=xyxyxyxyxyx ousy,ou=information services,ou=domain users,dc=corp,dc=xyxyxx,dc=com'
I am trying to extract the string between the first 'ou=' and the second comma. In this case that is'information services'
Here is what I have so far:SUBSTR(F_DN, locate('ou=', F_DN)+3, locate(',', F_DN, locate(',', F_DN)+1)+1 ) as roleAnd this is the result:'information services,ou=domain users,dc=co'
It seems to locate to the first character just fine but I cannot get the length correct.