| 
    			Skip Navigation LinksALVAO 8.2ALVAO Service DeskSystem Implementation in an OrganizationCustom Edits and ExtensionsSaving Attachments Outside Database
    			Skip Navigation Links.
    			
    			Skip Navigation Links
    			Skip Navigation Links. 
 
                
  
                   
                
                
                
                
                %USERPROFILE%\Documents\ALVAO\Doc\Documentation\doc\en\alvao_8_2\alvao_service_desk\implementation\customization\file_stream.aspx 
                
                
             | 
   			
				
Saving Attachments Outside Database
- Attachments can be saved also outside the database using the filestream technology. Attachments size is then not counted into the database size itself.
 
 
Enabling the Option to Save Attachments Outside Database
				- Enabling Filestream on the MS SQL Server
								- Enabling Filestream During the MS SQL Server Installation
												- Open the Database Engine Configuration page.
 
												- Enable the following options on the FILESTREAM tab gradually:
																- Enable FILESTREAM for Transact-SQL access
 
																- Enable FILESTREAM for file I/O streaming access
 
																- Allow remove clients to have streaming access to FILESTREAM data
 
												 
												 
												- Continue the installation.
 
								 
								 
								- Enabling Filestream After the MS SQL Server Installation
												- Launch SQL Server Configuration Manager.
 
												- Right-click on the SQL Server Service instance which you want to enable filestream to.
 
												- Enable all the options on the FILESTREAM tab gradually.
 
												- Click OK to save.
 
												- Launch SQL Server Management Studio
 
												- Launch the following SQL script over target DB ALVAO:
																- EXEC sp_configure filestream_access_level, 2
  GO  RECONFIGURE  GO 
												 
												 
								 
								 
								- Enabling Filestream from Command Line
												- Download the script enabling filestream from command line here.
 
												- Run the following command in the command line:
																- cscript filestream_enable.vbs /Machine:<machine name> /Instance:<sql server instance> /Level:3
    Parameters:      Machine: Target machine name. If not specified, local machine is selected.       Instance: Sql server instance. If not specified, default one (MSSQLSERVER) is used.       Level: FILESTREAM functionality level which will be enabled. If not specified, 3 will be selected.           0 – FILESTREAM functionality is disabled.          1 – Enables FILESTREAM for T-SQL access.          2 – Enables FILESTREAM for T-SQL and I/O streaming access, but does not enable remote I/O streaming access.          3 – Enables FILESTREAM for T-SQL and I/O streaming access and also for remote I/O streaming access. 
												 
												 
												- Launch SQL Server Management Studio
 
												- Launch the following SQL script over target DB ALVAO:
																- EXEC sp_configure filestream_access_level, 2
  GO  RECONFIGURE  GO 
												 
												 
								 
								 
				 
				 
				- Adding Filestream to Database
								- Launch SQL Server Management Studio.
 
								- Launch the following SQL script over target DB ALVAO:
												- ALTER DATABASE [<database_name>]
  ADD FILEGROUP fstDocumentGroup contains filestream;  go  declare @db_name varchar (MAX)  declare @filestream_loc varchar (MAX)  SELECT @db_name = physical_name FROM sys.master_files WHERE database_id = DB_ID(DB_NAME()) AND type_desc = 'ROWS'  set @db_name = REVERSE(RIGHT(REVERSE(@db_name),(LEN(@db_name)-CHARINDEX('\', REVERSE(@db_name),1))+1))  set @filestream_loc = @db_name + 'AlvaoFileStream'    DECLARE @AddFileSql varchar(max);  SET @AddFileSql = 'ALTER DATABASE [<database_name>]  ADD FILE  ( NAME = ''fstDocument'', FILENAME = ' + QuoteName( @filestream_loc, '''' ) + ')   TO FILEGROUP [fstDocumentGroup];  ';  EXEC (@AddFileSql); 
								 
								 
				 
				 
				- Adding Filestream into tDocument Table
								- Launch SQL Server Management Studio.
 
								- Launch the following SQL script over target DB ALVAO:
												- ALTER TABLE dbo.tDocument SET (FILESTREAM_ON = fstDocumentGroup)
  GO  ALTER Table dbo.tDocument  ADD uniqueGUID UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL   CONSTRAINT UQ_tDocument_uniqueGUID UNIQUE   CONSTRAINT DF_tDocument_uniqueGUID DEFAULT newid()  GO    ALTER TABLE dbo.tDocument  ADD TempColumn varbinary(max) FILESTREAM NULL  GO    DECLARE @curId INT  DECLARE @db_cursor CURSOR   SET @db_cursor = CURSOR FOR  SELECT iDocumentId FROM dbo.tDocument WHERE oDocument IS NOT NULL    OPEN @db_cursor   FETCH NEXT FROM @db_cursor INTO @curId    WHILE @@FETCH_STATUS = 0  BEGIN  UPDATE dbo.tDocument SET TempColumn = oDocument WHERE iDocumentId = @curId  UPDATE dbo.tDocument SET oDocument = NULL WHERE iDocumentId = @curId    FETCH NEXT FROM @db_cursor INTO @curId  END  CLOSE @db_cursor  DEALLOCATE @db_cursor  GO     ALTER TABLE dbo.tDocument DROP COLUMN oDocument  GO    EXEC sp_rename 'dbo.tDocument.TempColumn', 'oDocument', 'COLUMN'  GO 
								 
								 
				 
				 
 
Disabling the Option to Save Attachments Outside Database
				- Removing Filestream from tDocument Table
								- Launch the following script over target DB ALVAO in the SQL Server Management Studio:
												- ALTER TABLE dbo.tDocument ADD TempColumn varbinary(max)
  GO    DECLARE @curId INT  DECLARE @db_cursor CURSOR   SET @db_cursor = CURSOR FOR  SELECT iDocumentId FROM dbo.tDocument WHERE oDocument IS NOT NULL    OPEN @db_cursor   FETCH NEXT FROM @db_cursor INTO @curId    WHILE @@FETCH_STATUS = 0  BEGIN  UPDATE dbo.tDocument SET TempColumn = oDocument WHERE iDocumentId = @curId  UPDATE dbo.tDocument SET oDocument = NULL WHERE iDocumentId = @curId    FETCH NEXT FROM @db_cursor INTO @curId  END  CLOSE @db_cursor  DEALLOCATE @db_cursor    GO  ALTER TABLE dbo.tDocument DROP COLUMN oDocument  GO  EXEC sp_rename 'dbo.tDocument.TempColumn', 'oDocument', 'COLUMN'  GO  ALTER TABLE dbo.tDocument set (filestream_on = "NULL")  GO  ALTER TABLE dbo.tDocument ALTER COLUMN uniqueGUID DROP ROWGUIDCOL  GO  ALTER TABLE dbo.tDocument DROP CONSTRAINT DF_tDocument_uniqueGUID  GO  ALTER TABLE dbo.tDocument DROP CONSTRAINT UQ_tDocument_uniqueGUID  GO  ALTER TABLE dbo.tDocument DROP COLUMN uniqueGUID 
								 
								 
				 
				 
				- Removing Filestream from Database
								- Launch the following script in the SQL Management Studio:
												- ALTER DATABASE [<database_name>] REMOVE FILE fstDocument
  GO  ALTER DATABASE [<database_name>] REMOVE FILEGROUP fstDocumentGroup  GO 
								 
								 
				 
				 
				- Disabling Filestream on the MS SQL Server
								- Disabling in the SQL Configuration Manager
												- Launch SQL Server Management Studio.
 
												- Launch the following SQL script over target DB ALVAO:
																- EXEC sp_configure filestream_access_level, 0
  GO  RECONFIGURE  GO 
												 
												 
												- Launch SQL Server Configuration Manager.
 
												- Right-click on the SQL Server Service instance which you want to disable filestream to.
 
												- Disable all the options on the FILESTREAM tab gradually.
 
												- Click OK to save.
 
								 
								 
								- Disabling in Command Line
												- Launch SQL Server Management Studio.
 
												- Launch the following SQL script over target DB ALVAO:
																- EXEC sp_configure filestream_access_level, 0
  GO  RECONFIGURE  GO 
												 
												 
												- Download the script setting filestream from command line here.
 
												- Run the following command in the command line:
																- cscript filestream_enable.vbs /Machine:<machine name> /Instance:<sql server instance> /Level:0
 
												 
												 
								 
								 
				 
				 
 
                
                     
                   
                   
Did not find what you were looking for? Ask our technical support team.
                 
   			 |