BODS cannot create store procedure at DB2 at Unix
Hi,
I run BODS X3.1 and it can't create, drop store procedures at DB2 at unix. It recommends to authorize the user to do so. However, I have checked DB2 online doc, it mentioned need to set CREATE PROCEDURE authority. However, I can't find any command to do it.
Does anyone using DB2 that can provide help?
Thank you.
I think I got found the bug. It is select from a regular table to load another regular table using Auto correct load method. If only normal loading, no create procedure sql is generated and no warning message.
For using Auto correct load method:
(1) first, it got to perform drop procedure as:
DROP PROCEDURE "BODSOWN".di1125368_1FOOTE; .
Note:
(a) I run this command at db2 and it contain syntax error, saying:
SQL0104N An unexpected token ";" was found following "WN".di1125368_1FOOTE".
(b) which mean the semicolon ; is not needed. If I delete this ; away, it can go through but still will complain the stored procedure "BODSOWN.di1125368_1FOOTE" doesn't exist. But that is another issue which is expected.
(2) secondly, It will generate a CREATE PROCEDURE as such:
CREATE PROCEDURE
"BODSOWN".di1125368_1FOOTE ( IN before_c1 VARCHAR (100) , IN after_c1 VARCHAR (1) , IN after_c2 VARCHAR (40) , IN after_c3
INTEGER , IN after_c4 VARCHAR (100) )
LANGUAGE SQL
BEGIN
DECLARE local_var INT DEFAULT 0;
SELECT COUNT(*) INTO local_var
FROM "BODSOWN"."FOOTER_RECORD"
WHERE "DI_FILENAME" = before_c1 ;
IF local_var = 0 THEN
INSERT INTO "BODSOWN"."FOOTER_RECORD" ("RECORD_TYPE", "SRCSYS_OR_COUNTER", "ROW_COUNTER", "DI_FILENAME")
VALUES (after_c1, after_c2, after_c3, after_c4 );
ELSE
UPDATE "BODSOWN"."FOOTER_RECORD"
SET "RECORD_TYPE" = after_c1 ,
"SRCSYS_OR_COUNTER" = after_c2 ,
"ROW_COUNTER" = after_c3 ,
WHERE "DI_FILENAME" = before_c1 ;
END IF;
END
Note:
(a) this create procedure contains syntax error, the line "ROW_COUNTER" = after_c3 , a comma shouldn't be inserted which afterward is the WHERE clause. Meaning is should be "ROW_COUNTER" = after_c3 without comma.
(b) if i run this create procedure at db2 without the comma error, it will be successful, if not if will give error saying:
SQL0104N An unexpected token ""DI_FILENAME"" was found following "" =
after_c3 , WHERE".
Similar Messages
-
Exec XP_CMDSHELL cannot find store procedure problem
I run EXEC sp_configure 'xp_cmdshell', 1
Message is"....change from 1 to 1 "
Then
EXECXP_CMDSHELL 'Dir N:'
cannot find store procedure xp_cmdshell
I check master database.
No dbo.xp_cmdshell under store procedure.
How to fix it? I need run command
EXECXP_CMDSHELL 'Dir N:'
ThanksHallo Bestrongself,
- what SQL Server version do you use?
- since SQL 2005 xp_cmdshell is located in the sys-schema and the procedure itself is located in the resource database of Microsoft SQL Server.
You can check xp_cmdshell by using the following command:
SELECT * FROM sys.all_objects WHERE name = 'XP_CMDSHELL'
I bet you will see it in the master database because you cannot drop system procedures and will return an error if you try to do so:
USE master;
GO
BEGIN TRANSACTION
DROP PROCEDURE dbo.xp_cmdshell;
DROP PROCEDURE sys.xp_cmdshell;
DROP PROCEDURE xp_cmdshell;
ROLLBACK TRANSACTION
To execute xp_cmdshell you need to have [CONTROL SERVER] permissions otherwise it won't work. Let's say I have a login which I grant exclusive permissions to execute xp_cmdshell it will fail!
USE master;
GO
-- create the login and the user in master-database
CREATE LOGIN test WITH PASSWORD = 'glmdpf12345', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF;
CREATE USER test FROM LOGIN [Test];
GO
-- grant explicit permission to execute the xp_cmdshell
GRANT EXECUTE ON sys.xp_cmdshell TO test;
GO
-- tryp to execute xp_cmdshell as test
EXECUTE AS login = 'test'
EXEC xp_cmdshell 'DIR C:';
REVERT
-- Housekeeping
REVOKE EXECUTE ON sys.xp_cmdshell TO test;
DROP USER 'test';
DROP LOGIN 'test';
As you can see from the above statement the login "Test" got exclusive permission to execute xp_cmdshell but the execution will fail with the following error message:
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.
The above error message is clear. Test is a "normal" user which has the permission to execute the proc BUT due to missing permissions to retrieve the information about the service account it fails!
You have to grant SERVER CONTROL to the account.
So - next step...
What is your permission on server level?
You can check your permissions by using the following statement:
-- what are my permissions on server level
-- check for CONTROL SERVER!
SELECT * FROM sys.fn_my_permissions (NULL, 'SERVER') ORDER BY permission_name;
-- what are my permissions for the object xp_cmdshell
SELECT * FROM sys.fn_my_permissions('xp_cmdshell', 'OBJECT');
Can you provide us with the results of the above query?
BTW: xp_cmdshell is a well documented statement and official command which is fully supported by Microsoft. You can find all information about functionality and security of xp_cmdshell here:
http://technet.microsoft.com/en-us/library/ms175046.aspx
MCM - SQL Server 2008
MCSE - SQL Server 2012
db Berater GmbH
SQL Server Blog (german only) -
Create Store Procedure to Count Number of records in Database for each table
Hello,
I have created the code which counts the number of records for each table in database. However, I want create store procedure for this code this code that when ever use execute the Store Procedure can provide the database name to execute it and as a result
table will display number of records in each table.
Below you will find the code its working:
CREATE
TABLE #TEMPCOUNT
(TABLENAME
NVARCHAR(128),
RECORD_COUNT BIGINT)
-- Creating a TEMP table
EXEC
sp_msforeachtable
'insert #tempcount select ''?'', count(*) from ? with (nolock)'
SELECT
* FROM
#TEMPCOUNT
ORDER
BY TABLENAME
DROP
TABLE #TEMPCOUNT
This code need to be convert in store procedure and user can give database name when execute the procedure in order to count the records.
Looking forward for your support.
Thanks.
SharePoint_Consultant_EMEASomething like:
set quoted_identifier off
go
create procedure usp_TableCounts
@DBName as varchar(1000)
as
set nocount on
declare @SQLToExecute varchar(1000)
CREATE TABLE #TEMPCOUNT (TABLENAME NVARCHAR(128), RECORD_COUNT BIGINT) -- Creating a TEMP table
set @SQLToExecute = @DBName + ".dbo.sp_msforeachtable 'insert into #tempcount select ''?'', count(*) from ? with (nolock)'"
print @SQLToExecute
exec (@SQLToExecute)
SELECT * FROM #TEMPCOUNT
ORDER BY TABLENAME
DROP TABLE #TEMPCOUNT
GO
Satish Kartan www.sqlfood.com -
Help On create Store Procedure
I need to Create a Store Procedure under a different from the once I am connected.
ThanksIf you have the DB rights to do it, use
create procedure owner.proc_name as ... -
Cannot create stored procedure in Azure SQL database
When I try to create a stored procedure using Management Studio
(Snippet follows
use
PPSC_Sky_Data
go
/****** Object: StoredProcedure [dbo].[sp_RegisterProd] Script Date: 17-02-2015 17:52:50 ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
proc [dbo].[sp_RegisterProd]
@inputMachid nvarchar(50),@inputDomainname
nvarchar(255),@inputwsid
nvarchar(255),@inputipv4
nvarchar(50),
@custno
as
nvarchar(50),@email
as
nvarchar(50),@telephone
as
nvarchar(50),@RegType
as
int
(end of snippet)
It fails with message 40508 - (not allowed to switch between databases) then tells me I am not authorized to create an SP in the Master db.
So....
How can I create a procedure in AZURE Sql?
Thanks
Murray
M WhippsHi 9gwcycn,
Creating stored procedures is not allowed in Master Database. You have to switch to Database
PPSC_Sky_Data manually, use statement is not supported. After that could you please confirm again? As Creating and altering Stored procedures work fine from my SSMS.
If you have any feedback on our support, please click
here.
Eric Zhang
TechNet Community Support -
How to create store procedure using cursor, and looping condition with exce
Hi,
I am new in pl/sql development , please help me for follwoing
1. I have select query by joining few tables which returns lets say 100 records.
2. I want to insert records into another table(lets say table name is tbl_sale).
3. If first record is inserted into tbl_sale,and for next record if value is same as first then update into tbl_sale else
insert new row
4. I want to achieve this using store procedure.
Please help me how to do looping,how to use cursor and all other necessary thing to achieve this.DECLARE
b NUMBER;
BEGIN
UPDATE tbl_sale
SET a = b
WHERE a = 1;
IF SQL%ROWCOUNT = 0
THEN
INSERT INTO tbl_sale
(a
VALUES (b
END IF;
END;note : handle exceptions where ever needed
Regards,
friend
Edited by: most wanted!!!! on Mar 18, 2013 12:06 AM -
How to create Store Procedure for export result select in .txt or .csv
Hello,
I'm using MSSQL Server.
How to export results query in .txt or .csv?
But
I can not use bcp or SQLCMD.1) linked server
insert into txtsrv...table1#txt(CustomerNumber,CustomerName,EntryDate)
select orderid, shipname, orderdate
from Northwind..orders
Set up the linked server
Connecting a directory of text files as a linked server is easy. Here’s how:
In Windows, create a new directory for the linked server.
For this article, that directory will be E:\txtsvr.
Add that directory as a linked server with sp_addlinkedserver:
EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0', 'e:\txtsrv', NULL, 'Text'
That’s all that’s required to add the linked server txtsrv
as a connection to the text files in E:\txtsvr, but there are
no tables in txtsvr yet. Also missing is a required file, schema.ini,
which must contain a description of each table’s format.
You can learn more about schema.ini from the Microsoft MSDN Library,
but for now, just use Notepad or your favorite text editor
to create the file e:\txtsrv\schema.ini as shown in Listing 1.
In addition, create an empty text file in e:\txtsrv named table1.txt.
The file e:\txtsrv\table1.txt is now an empty table in the linked server txtsrv.
We can see that if we list information about all the tables in txtserv with
the system stored procedure sp_tables_ex:
EXEC sp_addlinkedsrvlogin txtsrv, FALSE, Admin, NULL
EXEC sp_tables_ex txtsrv
Text files are tables
We can’t issue a CREATE TABLE statement against this linked server,
but we have created a table easily enough. We can, however,
run INSERT and SELECT queries, if we use the four-part naming
convention <server>…<table> (that’s three dots):
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Insert and update same record of table using store procedure in oracle 10g
Hi,
I am using oracle sql developer for this.
I have created Store procedure which run after every 30mins of interval.
the problem is Ii need to insert data for first time of day then later that same record should update for particular field(here its plan code).
if new field is coming (if new plan code is generated) then it should insert data and again update same for interval.
means for each plan individual record(i.e. plan wise summary) should be there for only a day. next day new record for same plan.Hi,
You should use Merge like shown below:-
Merge into original_table a
using second_table b
on (a.primary_key=b.primary_key and a.primary_key........)
when match then
update set column_list=b.column_list
when not match then
isert into (column list)
values(a.column_list)If you dont know much about merge then follow below link..
http://www.oracle-developer.net/display.php?id=203
http://www.oracle-base.com/articles/10g/merge-enhancements-10g.php -
Hi all I face a error in create store procedure with like this code can u tel me what i did wrong .
here is my code
Create PROCEDURE [dbo].[FACT_CURRENT_VS_PRV]
@country nvarchar (50)
AS
BEGIN
if @command='XPO1'
BEGIN
WITH CurrentMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 3
PreviousMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 4
SELECT * FROM CurrentMonth
except
END
If @country='XPO2'
BEGIN
WITH CurrentMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 1
PreviousMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 2
SELECT * FROM CurrentMonth
except
select * FROM PreviousMonth
END
END
and i got this error
Msg 319, Level 15, State 1, Procedure FACT_CURRENT_VS_PRV, Line 116
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Msg 102, Level 15, State 1, Procedure FACT_CURRENT_VS_PRV, Line 152
Incorrect syntax near ','.
I m little bit confused why its happen
Thanks for helpThe error message is obvious. each CTE has to be preceded by ;
so use like this
Create PROCEDURE [dbo].[FACT_CURRENT_VS_PRV]
@country nvarchar (50)
AS
BEGIN
if @command='XPO1'
BEGIN
;WITH CurrentMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 3
PreviousMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 4
SELECT * FROM CurrentMonth
except <you're missing something here>
END
If @country='XPO2'
BEGIN
;WITH CurrentMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 1
PreviousMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 2
SELECT * FROM CurrentMonth
except
select * FROM PreviousMonth
END
END
I think you're missing a statement after except in first condition
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
User define table and store procedure install
Hi there,
I like to deploy an addon, there are User define tables and store procedure need add to database, I wonder which chance is properly to add them, if add these user define objects in time of install, we can not get the enough information that connect to SQL server, and also create UDT need DIAPI. if put create UDT and UDsp in addon program, the problem is which DIAPI funciton or object can execute create store procedure SQL string.
Thanks for any help.
LanjunR. Schwachofer,
Thank you very much,
the way call isqlw.exe to run SQL script is a good way when install, but I confuse with two questions about this way. first, run isqlw.exe should provid loginid and password of SQL server, these two information need additional install dialog to get; second if use isqlw.exe the store procedure only create to the current company database, when create new compay DB the store procedure does not exist in new DB.
so I still do not know which way is the proper way to create SP for addon.
Thanks in advance.
Lanjun -
How to create a schema and assign roles with store procedure or function?
Hi All,
I am creating a webpage that will call oracle store procedure or function to create a schema and add roles. Please let me know if there a method to do that.
Thank youHi CristiBoboc,
Thank you very much for your help. Here is my code to create a user:
create or replace
FUNCTION user_create (user_name IN nvarchar2, user_pw IN nvarchar2)
RETURN number
IS
sql_stmt varchar2(200);
sql_stmt2 varchar2(200);
var_temp_count NUMBER(2);
un varchar2(30) := user_name;
up varchar2(30) := user_pw;
BEGIN
sql_stmt := 'create user :1 identified by :2
default tablespace users
temporary tablespace temp
quota 5m on users';
sql_stmt2 := 'grant developers to :1';
EXECUTE IMMEDIATE sql_stmt USING un,up;
EXECUTE IMMEDIATE sql_stmt2 USING un;
select count(*) into var_temp_count from dba_users where username = UPPER(user_name);
return var_temp_count;
END;
When I run, I get following error:
exec :myvar :=user_create('aaa','12345');
BEGIN :myvar :=user_create('aaa','12345'); END;
ERROR at line 1:
ORA-01935: missing user or role name
ORA-06512: at "CSDBA.USER_CREATE", line 15
ORA-06512: at line 1 -
Hello,
I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
Suppose ,
Parameter value : person 1,person2,person3
table structure :
Project Name | officers 1 | officers 2
here, officers 1 or officers 2 may contain names of multiple people.
expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2.
please explain or provide solution in detail
- ThanksHi Visakh,
Thanks for reply.
But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
Your solution is working fine for following scenario :
Project
Officers 1
Officers 2
p1
of11
off21
p2
of12
off22
with parameter : of11,off22 : it will give expected output
And its not working in case of :
Project
Officers 1
Officers 2
p1
of11,of12
off21,off23
p2
of12,of13
off22,off24
with parameter : of11,off22 : it will not give any row in output
I need patten matching not exact match :)
ok
if thats the case use this modified logic
CREATE PROC GetProjectDetails
@PersonList varchar(5000)
AS
SELECT p.*
FROM ProjectTable p
INNER JOIN dbo.ParseValues(@PersonList,',')f
ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
GO
Keep in mind that what you've done is a wrong design approach
You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Mountain Lion fails to install saying it cannot create the recovery; I had a similar problem with Lion and the Apple Store that helped me resolve it gave me an installable version of Mountain Lion on a flash drive for my inconvenience....is there some trick I am missing or do I need to make an appointment with a genius...
I have the MacIntosh volume and the Boot Camp partition only. I know that when I installed Lion, I had to go through a whole back-up and recovery of Windows and then re-format the drive.
The tech at the Apple Store had a previous life as a MSCE and was very helpful. I believe he even said that I should not have htis problem with Mountain Lion which is why they gave me the flash with it onboard. I was in the process of starting a new job when I went to Lion, so I have waited to do this next and probably last upgrade to this old MBP since I doubt Apple will support this MBP in Maverick.
I do not have another installation, so that is not an option. I will try to create an external, I have plenty of hard drives around and see if I can get it done that way. It might take me a week or two to get back to it, but I will comment back upon completion of that effort. Thanks for your help....Dave Iverson -
Create directory issue in Store Procedure
Hi Guys,
can any one help?
I am using XP, Oracle 10g, sql developer and Sql Plus.
I am trying to create directory in storeprocedure, but it not let me to do that thing. below is the statement i am using
create or replace directory public_access as '/tmp/public_access';
please let me know hoe can i initialize my dir object in store procedure.
Thanksuser13012136 wrote:
Hi Guys,
can any one help?
I am using XP, Oracle 10g, sql developer and Sql Plus.
I am trying to create directory in storeprocedure, but it not let me to do that thing. below is the statement i am using
create or replace directory public_access as '/tmp/public_access';
please let me know hoe can i initialize my dir object in store procedure.
ThanksTypically best NOT to do something like this in a procedure, but there are cases where it's needed.
In those cases, you need to use Native Dynamic SQL.
execute immediate 'create or replace directory public_access as ''/tmp/public_access'''; Assuming your syntax was correct before (i just copied and pasted what you had, adding quotes where needed). -
- Why is it so easy to create stories, but you cannot group all them together for a simple PLAY all scenario, surely it can be done? I am about to give scripting a shot but seriously it looks way to confusing compared to stories, I have several sub menus and in each sub menu I have a play all story, however what I also want to do is create a PLAY ALL from the main menu, any suggestions
Erby60Duplicate all your stories, have a menu item with duplicate story 1 as the target, and set the end jump of duplicate story 1 to duplicate story 2, etc. Shouldn't that work? There may be a simpler way, but
As far as adding documents, The simplest way is to build in dvdsp and then add a folder containing the docs to the project folder that dvdsp has created and use toast to burn it. There may be a rule for naming this folder, but can't remember it at the moment.
Hey, ya know there's something called the dvdsp manual. A quick search found this
In addition to the VIDEO_TS or HVDVD_TS folder, there are other items that can be part of the format process:
A folder specified by the DVD-ROM content setting
DVD@CCESS Installers
You can change or set the folder to use for DVD-ROM content either when specifying the preformat settings or while configuring the format process. The DVD@CCESS Installers are included if the project used DVD@CCESS links and the Embed Text Data checkbox in the Disc Inspector is selected. See DVD@CCESS for more information on DVD@CCESS.
Maybe you are looking for
-
aloha I cannot seem to open pps files sent via email to me with anything, what am I missing? I have keynote 3.0.2 I admit i never have used it but this is the one to open PC pps files right? aloha
-
Can only edit one editable region
Hi, I have defined two editable regions in a template. I can edit one fine, but not the other. The one I cannot edit is for a submenu and picture on this site: 67.199.64.241/ Any ideas? Any help would be greatly appreciated. This is the code (which I
-
Does Index in Oracle Text lock local files?
Hi, I am planing to implement content search using file datastore. Let me explain how the whole search going to work, Users are going to upload the file, I am going to store the information about the file like filename, size, keywords, file path etc
-
TS1424 taking a long time to download
Download time seems to be taking forever. Any suggestions?
-
Hi everybody, does anyone know how to make a long click valuable on a JButton because MousePressed doesn't seem to manage it . If you have an idea , please tell me.