bugged.be

"Think outside the [B0X]"
Icon

Sql join update

The mssql way:

update user_asset_tag 
set uat.assetTypeId = ua.assetTypeId
from user_asset_tag uat
join user_asset ua on ua.id = uat.userAssetId

The Oracle way:

update (
  select ua.*
  , uat.AssetTypeId as assetTypeId2
  from user_asset ua
  join user_asset_tag uat on uat.userassetid = ua.id
)o 
set o.assetTypeId2 = o.assetTypeId

Oracle select range

select * from(
select t1.*,rownum rn from table t1 where rownum < 11
)where rn between 3 and 5

Countries db script

Script for creating database with countries. Read the rest of this entry »

An insert exec statement cannot be nested

Avoid ‘An insert exec statement cannot be nested’ by preparing a temp table from calling procedure and populate it by inner stored procedure.
Read the rest of this entry »

test whether sp exists

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[procedure]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[procedure]

Check #temp table exists

if ( object_id( 'tempdb..#test' ) is null )
-- table doesn't exist
print 'table doesnt exist'
else
-- table exists
print 'table exists'

test if column in table exists

select * from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME=’tablename’
and COLUMN_NAME=’columname’

Gtk-WARNING … “ubuntulooks”

The following error occurs when starting any of the mysql tools, s:

(mysql-administrator-bin:6452): Gtk-WARNING **:
Unable to locate theme engine in module_path: "ubuntulooks"

Read the rest of this entry »

Calendar

May 2019
M T W T F S S
« Nov    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Archives