Using Groovy to Deploy Federated (or Linked Server) views

I have several federated server / linked views in SQL Server 2000, which allows querying across multiple servers and databases simultaneously. While very powerful, there are some limitations. The primary database server has some linked servers defined. The primary database has a view defined in it which points to a specific linked server and linked database. Unfortunately, Linked Server aliases are not supported and the linked database name varies between environments. Because the View has the Linked Server and Database

Read more

SpagoBI Groovy LOV for Last Day of Last Month

SpagoBI Lookup Value (LOV) in Groovy to get the last day of last month 1 2 3 4 5 6 7 8 9 10 11 12 Calendar cal = Calendar.getInstance() cal.add(Calendar.MONTH, -1) cal.set(Calendar.DATE, 1) Date firstDateOfPreviousMonth = cal.getTime() cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE)) Date prevDate = cal.getTime()   //You pick whether you like sprintf or GString better //String returnStr = "${(cal.get(Calendar.MONTH)+1).toString().padLeft(2,’0′)}/${(cal.get(Calendar.DATE)).toString().padLeft(2,’0′)}/${cal.get(Calendar.YEAR)}" //return returnStr.toString() String returnStr = sprintf("%02d/%02d/%4d", cal.get(Calendar.MONTH)+1, cal.get(Calendar.DATE), cal.get(Calendar.YEAR)) return returnStrCalendar cal = Calendar.getInstance() cal.add(Calendar.MONTH, -1) cal.set(Calendar.DATE, 1) Date firstDateOfPreviousMonth = cal.getTime()

Read more

SQL Server – get all triggers

Here is an often used SQL statement to get a list of Triggers, in SQL Server. I’m posting this here for my own convenience and perhaps someone else will benefit. SELECT   [so].[name] AS sys_obj,   so.type,   USER_NAME([so].[uid]) AS obj_owner,   USER_NAME([so2].[uid]) AS table_schema,   OBJECT_NAME([so].[parent_obj]) AS table_name,   OBJECTPROPERTY( [so].[id], ‘ExecIsUpdateTrigger’) AS [isupdate],   OBJECTPROPERTY( [so].[id], ‘ExecIsDeleteTrigger’) AS [isdelete],   OBJECTPROPERTY( [so].[id], ‘ExecIsInsertTrigger’) AS [isinsert],   OBJECTPROPERTY( [so].[id], ‘ExecIsAfterTrigger’) AS [isafter],   OBJECTPROPERTY( [so].[id], ‘ExecIsInsteadOfTrigger’) AS [isinsteadof],  

Read more