By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

how to qeuey this in paadmin like mssql

P: 2
if not exists(select * from table )
begin

insert into table(tabname,colname,chnname) select ''',''




end
Dec 6 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 700
if not exists(select * from table )
begin

insert into table(tabname,colname,chnname) select ''',''




end
What this query should do?
What does it mean
>>insert into table(tabname,colname,chnname) select ''','' ?
Dec 6 '07 #2

P: 2
in the pgadmin edit
i want use
if exists
if @@rowcout>0
if ....
like in mssql and not function
how to
sorry for my english
Dec 7 '07 #3

Expert 100+
P: 700
in the pgadmin edit
i want use
if exists
if @@rowcout>0
if ....
like in mssql and not function
how to
sorry for my english
I'm afraid it would very hard to withou a function. In my opinion it would be enough to definie a function that execute dynamic queries like
create function execute(varchar) returns void as $$
begin
execute $1;
return;
end;
$$ language plpgsql

and use it for example
table is tab(i int,j int,k,int)
and query
select execute('insert into tab values(''1'',''2'',''3'')') where exists (select * from information_schema.tables where table_name='tab');
and you can extend it adding more conditions to the where clause
Dec 9 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.