SQL Server

Stored Procedure for attaching file to an Activity

Morning,

Has anyone had any experience with attaching a file to a Customer Activity record using a stored procedure?

We use TaskCentre to run a stored procedure to generate activities for emails but would like to start adding a pdf version of the email as an activity (the same way iEmail does).
Before I go down the road of trying to write it I wanted to see if their was generic code floating around.

Grouping in SSRS reports in iMIS.

Here are the .rdl file and the export of the query related to my forum entry.

Error Message when inserting Activity/ creating invoice from Order

This is the message i get when trying to insert a new activity to Manage Committees and when converting an order to an invoice.  I am not sure if this is the proper place to post it or if is is related to the SQL server or something else.
WinIO/63 2627
23000:[Microsoft][ODBC SQL Server dirver] [SQL Server]Violation of PRIMARY KEY contraint ‘pkActivitySEQN’.
Cannot insert duplicate key in object’dbo.Activity’. 01000:[Microsoft][ODBC SQUL Server Driver] [SQUL Server]The statement has been terminated.

Subreports in iMIS

Hi I had a question about subreports and iMIS.  I created a subreport but I am having trouble accessing it in iMIS.  I created the report and subreport with 2 different VIEWs and granted both of them access to iMIS and uploaded them to iMIS.  When I click on the report, it loads up fine, however, I can not click on the subreport.  It looks like a link but it does not let me click on it.  Does anyone know how to get around this?

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