Archives

Archive for the ‘SQL’ Category

Use the following script to shrink/truncate SQL database log file USE [Database_Name] GO ALTER DATABASE [Database_Name] SET RECOVERY SIMPLE WITH NO_WAIT DBCC SHRINKFILE(DB_Log_File_Logical_Name, 1) ALTER DATABASE [Database_Name] SET RECOVERY FULL WITH NO_WAIT GO Use the following script to check the file size. USE [Database_Name] GO select name,  size from sys.database_files  

Oct 15th, 2011 | Filed under Development, SQL

When you try restoring a SQL database, you may get an error message saying “Exclusive access can’t obtained, database is in use”.   First, of course, stop all Syteline service, like IDO, Taskman.  If it still doesn’t work, try the below to set it to single user mode Use Master Alter Database Database_Name  SET SINGLE_USER With […]

Oct 15th, 2011 | Filed under Development, SQL

Requirements If you are trying to restore database backup of SQL Server 2008 to SQL Server 2005, you are bound to fail. Database backup of SQL Server 2008 is not compatible backward, you cannot restore it to SQL Server 2005. The following is a solution to convert databases of SQL Server 2008 to 2005 Step […]

Jul 11th, 2011 | Filed under SQL

If you have hundreds users, manually rebuilding the User/Module Authorization will be painful.  The below query will copy over the User/Module Authorization from source DB to target DB.  Just run it against your target DB. insert  modulemembers (objecttype, objectname, modulename, originalmodulename, modulememberspec) select objecttype, objectname, modulename, originalmodulename, modulememberspec from [Your_Source_DB_name].[dbo].[modulemembers] where objectname like ‘OS_%’

Jan 17th, 2011 | Filed under Development, Implementation, SQL

If you even need to find out all store procedures that contain certain phrase, such as “PurchaseOrders”, the following query will help. select so.name, sc.text from syscomments sc inner join sysobjects so on sc.id = so.id where so.xtype = ‘P’ and sc.text like ‘%PurchaseOrders%’ This can be extended to other object type, for example ‘TR’ […]

Jan 17th, 2011 | Filed under Development, SQL

If you are a Syteline administrator, you will often need to refresh your Test/Training database with update-to-date Production database. The most common way for copying DBs in SQL server is to use the backup/restore function. 1) Bring down all Infor service. 2) Backup your Syteline production database. In SQL management studio, right click database name, […]

Jan 17th, 2011 | Filed under Development, Implementation, SQL

Here is the way to check a form’s mode in script. If Instr(1, ucase(ThisForm.Caption), “(FILTER IN PLACE)”) > 0  Then ReturnValue = “-1” Exit Sub End If

Jan 16th, 2011 | Filed under Development, SQL, VB .Net

I think this is one of the FAQ question for T-SQL programmer, and here is some quick sample  Last Day of Previous Month SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))  Last Day of Current Month SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)) Last Day of Next Month SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+2,0)) Show name of the month: select datename (mm, date_field) Or if you want […]

May 16th, 2010 | Filed under SQL
Tags:

In Syteline, there are many ways to default field value.  The most simple way is to use the default value property of the field component.  But if you need to set the default value based on some other field value, that simple property value would not cut it. Syteline Application Case We want to default […]

Mar 23rd, 2010 | Filed under Development, SQL, VB .Net

We will use a sample to run through the process of adding a CLM into IDO.  Part of making the Customer Document Profile function available to RMA verification report, we need to create a new CLM to IDO SLRmas.  The CLM is based on SP  navProfileRMAVerificationSp.  create PROCEDURE [dbo].[navProfileRMAVerificationSp] (    @RMAStatusOpen                   ListYesNoType       = NULL, […]

Mar 17th, 2010 | Filed under Development, SQL