SQL Server

Saving CContact object is very slow.

I have been having an issue with slowness involved with calling the Save() method on a CContact object using iBO for .NET.  When saving a CContact object, it consistantly takes 8-12 seconds to complete. We have a rather large database (over 600,000 records in the Name table), and it seems that the issue lies within the asi_Name_Insert_Update trigger, more specifically the asi_FixDuplicateIndividualRows stored procedure that runs when the MEMBER_TYPE, COMPANY_RECORD, or MEMBER_RECORD columns are edited.

SELECT @@VERSION returns the service pack number in SQL Server 2008

Up through SQL Server 7.0, to determine the level of SQL Server, the routine was to execute SELECT @@VERSION, note the version number, and look it up in the table on the Microsoft site -- http://support.microsoft.com/kb/321185 .

With SQL Server 2000, SELECT SERVERPROPERTY ('ProductLevel') was introduced, which returns "RTM", "SPn", or "Bn", for Release to Manufacturing, Service Pack n, or Beta n.

Central Management Servers on SQL Server 2008

This is a new feature in SQL 2008 - a clever way to manage multiple servers

http://www.sqlshare.com/player.aspx?vid=673

SQL User_names in 10.6 are what in 15.1

Hi people.

In 10.6  our users run an ADHOC query to identify which records they have touched during the day to produce labels to post out their results..

In this case the Name_Results_Summary  table where their username is entered into the table in the updated_by field.

Here is the username element fo the adhoc..

Name_Results_Summary.UPDATED_BY = Substring(user_name(),1,Case when charindex('_',user_name()) > 0 Then charindex('_',user_name())-1 Else len(user_name())End )

Refreshing View Meta-Data

When database schema changes, as it often does during upgrades or customizations, any existing views refering to that schema remain unaltered.  For example, if a UserId field is lengthened from 30 to 60 characters in the schema, any view referencing that field will remain at 30 characters.  The solution to this, short of editing all the views, is to call sp_refreshview on the view.

The following is a little script that can be run on your database.  It will refresh the views for all schema objects in the 'dbo' schema (which includes all IMIS tables).  If you have a lot of tables in your database that exist in other schemas, you may wish to eliminate the clause that limits the script to only 'dbo', in order to ensure everything is refreshed and up to date.  This can be run at any time, and it is completely non-destructive.  If this script throws any errors, it's likely due to the existence of old obsolete views that reference schema that has either been renamed or dropped... you'll have to manually fix such issues by either fixing or dropping the offending view.

Simple View Template

/****** Object:  VIEW #VIEWNAME# ********************************/
-- Script Date: #DATE#
-- Dev Org:
-- Author: 
--
-- Description:
--
-- Change History:
/****************************************************************/
PRINT '----------- #VIEWNAME# ----------'
GO

IF EXISTS
(
SELECT  *
FROM    [sysobjects]
WHERE   [type] = 'V'
AND     [name] = '#VIEWNAME#'
)
BEGIN
PRINT   '  DROPPING EXISTING VIEW'
DROP VIEW [dbo].[#VIEWNAME#]
END
GO

Scaler Function Template

 PRINT '----------- #FUNC NAME# ----------'
GO

IF EXISTS
(
SELECT  [name]
FROM    [sysobjects]
WHERE   [id] = object_id(N'#FUNC NAME#')
AND     [type] = 'FN'
)
BEGIN
PRINT   '  DROPPING EXISTING FUNCTION'
DROP FUNCTION [dbo].[#FUNC NAME#]
END
GO

Table Template

/****** Object:  TABLE #TBLNAME# ********************************/
-- File:
-- Script Date: #DATE#
-- Author: 
--
-- Description:
--
-- Change History:
/****************************************************************/
PRINT '----------- #TBLNAME# ----------'
GO

IF object_id(N'#TBLNAME#', 'U') IS NOT NULL
BEGIN
 PRINT '  DROPPING EXISTING CONSTRAINTS'

Simple Stored Procedure Template

PRINT '----------- #SP_NAME# ----------'
GO

IF Object_Id(N'#SP_NAME#', N'P') IS NOT NULL
BEGIN
PRINT   '  RECREATING PROCEDURE #SP_NAME#'
DROP PROCEDURE [#SP_NAME#]
END
ELSE
BEGIN
PRINT   '  CREATING PROCEDURE #SP_NAME#'
END
GO

SQL Server Reporting Services (SSRS) in iMIS 15.1 - Innovations handout

The handout from the Innovations 2009 SSRS presentation is attached.