Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Friday, March 23, 2012

install in customer server

Hello,

I'm looking for a script to export all reports from server A (include all folder tree/datasource and reports) to a file in order to import in server B ?

I'm looking the export and import scrip in order to install my reports in the customer server

(I'm using SQL 2005)

Thanks


There are some KB Articles see http://support.microsoft.com/default.aspx?scid=kb;en-us;842425 and some links in it...
Here is the way I do it:
-Install SQL Server + Reporting Services on the destination maschine.
-Export the ReportServer and ReportServerTempDB on source maschine via SQL Server Management Studio
-Export the key with the ReportServer-config tool.
-Run my bat-File (see below) on destination maschine

You have to adjust the bold parts!
For RSKeyMgmt key.snk is the file containing your key and report is the password.
The bat file should stop the specific services on Win2k and WinXP (maybe in Win2003), if you expierence problems stop SQL Server Reporting Services and WWW- Publishing manually before running the .bat file.
create a .bat file containing:
net stop "SQL Server Reporting Services (MSSQLSERVER)"
net stop "World Wide Web Publishing Service"
net stop "WWW-Publishing"
sqlcmd -i restore.sql
net start "World Wide Web Publishing Service"
net start "WWW-Publishing"
net start "SQL Server Reporting Services (MSSQLSERVER)"

RSConfig -c -s localhost -d ReportServer -a Windows
RSKeyMgmt -a -f key.snk -p report
create restore.sql containing:
/****** Drop Databases ******/

EXEC msdb.dbo.sp_delete_database_backuphistory @.database_name = N'ReportServerTempDB'
GO
USE [master]
GO
DROP DATABASE [ReportServerTempDB]
GO

EXEC msdb.dbo.sp_delete_database_backuphistory @.database_name = N'ReportServer'
GO
USE [master]
GO
DROP DATABASE [ReportServer]
GO

/****** Restore Databases ******/
RESTORE DATABASE [ReportServer] FROM
DISK = N'E:\Program Files\Microsoft SQL Server\Scripts\backup\ReportServer.bak' WITH FILE = 1,
/* Specify Source! Absolute pathnames */

MOVE N'ReportServer' TO N'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ReportServer.mdf',
MOVE N'ReportServer_log' TO N'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ReportServer_log.LDF',
/* if the installation is on a different drive you need to move the files */

NOUNLOAD, STATS = 10
GO


RESTORE DATABASE [ReportServerTempDB] FROM
DISK = N'E:\Program Files\Microsoft SQL Server\Scripts\backup\ReportServerTempDB.bak' WITH FILE = 1,
/* Specify Source! Absolute pathnames */

MOVE N'ReportServerTempDB' TO N'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ReportServerTempDB.mdf',
MOVE N'ReportServerTempDB_log' TO N'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ReportServerTempDB_log.LDF',
/* if the installation is on a different drive you need to move the files */

NOUNLOAD, STATS = 10
GO



/****** Restore rights ******/
USE master
GO

DECLARE @.AccountName nvarchar(260)
SET @.AccountName = 'MASCHINENAME\ASPNET'

if not exists (select name from syslogins where name = @.AccountName and hasaccess = 1 and isntname = 1)
BEGIN
EXEC sp_grantlogin @.AccountName
END
GO

USE [ReportServer]
GO

DECLARE @.AccountName nvarchar(260)
SET @.AccountName = 'MASCHINENAME\ASPNET'

DECLARE @.name_in_db nvarchar(260)
select @.name_in_db = sysusers.name from sysusers inner join master.dbo.syslogins logins on logins.sid = sysusers.sid where logins.name = @.AccountName and logins.isntname = 1
if @.name_in_db IS NULL
BEGIN
EXEC sp_grantdbaccess @.AccountName, @.name_in_db OUTPUT
END
IF @.name_in_db IS NOT NULL AND @.name_in_db != 'dbo' AND @.name_in_db != 'sys'
BEGIN
EXEC sp_addrolemember 'RSExecRole', @.name_in_db
END
GO

USE [ReportServerTempDB]
GO

DECLARE @.AccountName nvarchar(260)
SET @.AccountName = 'MASCHINENAME\ASPNET'

DECLARE @.name_in_db nvarchar(260)
select @.name_in_db = sysusers.name from sysusers inner join master.dbo.syslogins logins on logins.sid = sysusers.sid where logins.name = @.AccountName and logins.isntname = 1
if @.name_in_db IS NULL
BEGIN
EXEC sp_grantdbaccess @.AccountName, @.name_in_db OUTPUT
END
IF @.name_in_db IS NOT NULL AND @.name_in_db != 'dbo' AND @.name_in_db != 'sys'
BEGIN
EXEC sp_addrolemember 'RSExecRole', @.name_in_db
END
GO

USE msdb
GO

DECLARE @.AccountName nvarchar(260)
SET @.AccountName = 'MASCHINENAME\ASPNET'

DECLARE @.name_in_db nvarchar(260)
select @.name_in_db = sysusers.name from sysusers inner join master.dbo.syslogins logins on logins.sid = sysusers.sid where logins.name = @.AccountName and logins.isntname = 1
if @.name_in_db IS NULL
BEGIN
EXEC sp_grantdbaccess @.AccountName, @.name_in_db OUTPUT
END
IF @.name_in_db IS NOT NULL AND @.name_in_db != 'dbo' AND @.name_in_db != 'sys'
BEGIN
EXEC sp_addrolemember 'RSExecRole', @.name_in_db
END
GO

USE master
GO

DECLARE @.AccountName nvarchar(260)
SET @.AccountName = 'MASCHINENAME\ASPNET'

DECLARE @.name_in_db nvarchar(260)
select @.name_in_db = sysusers.name from sysusers inner join master.dbo.syslogins logins on logins.sid = sysusers.sid where logins.name = @.AccountName and logins.isntname = 1
if @.name_in_db IS NULL
BEGIN
EXEC sp_grantdbaccess @.AccountName, @.name_in_db OUTPUT
END
IF @.name_in_db IS NOT NULL AND @.name_in_db != 'dbo' AND @.name_in_db != 'sys'
BEGIN
EXEC sp_addrolemember 'RSExecRole', @.name_in_db
END
GO

|||

Thanks for response

I'm looking just export the reports and import the report on the client machine (my client have other reports so I can't use the database recovery method

Monday, March 12, 2012

Install

Is there a script that can give you the details of an installation for SQL s
erver 2000. What connection mode was used...etc
ThanksHi,
Have a look into serverproperty function in books online, But the
authentication mode can not selected using this function.
FYI, The authentication mode of SQL Server is stored in the registry, so you
need read the registry to check the authentication. Use the extended
procedure xp_regread to read the registry and get the authentication mode.
Thanks
Hari
MCDBA
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:27BA378C-E2BA-4ECD-8BF9-7B0C31959B78@.microsoft.com...
> Is there a script that can give you the details of an installation for SQL
server 2000. What connection mode was used...etc
> Thanks|||The install details for SQL Server are stored in a file called SQLSTP.log...
You will find it in the windows directory...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:27BA378C-E2BA-4ECD-8BF9-7B0C31959B78@.microsoft.com...
> Is there a script that can give you the details of an installation for SQL
server 2000. What connection mode was used...etc
> Thanks

Install

Is there a script that can give you the details of an installation for SQL server 2000. What connection mode was used...etc
ThanksHi,
Have a look into serverproperty function in books online, But the
authentication mode can not selected using this function.
FYI, The authentication mode of SQL Server is stored in the registry, so you
need read the registry to check the authentication. Use the extended
procedure xp_regread to read the registry and get the authentication mode.
Thanks
Hari
MCDBA
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:27BA378C-E2BA-4ECD-8BF9-7B0C31959B78@.microsoft.com...
> Is there a script that can give you the details of an installation for SQL
server 2000. What connection mode was used...etc
> Thanks|||The install details for SQL Server are stored in a file called SQLSTP.log...
You will find it in the windows directory...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:27BA378C-E2BA-4ECD-8BF9-7B0C31959B78@.microsoft.com...
> Is there a script that can give you the details of an installation for SQL
server 2000. What connection mode was used...etc
> Thanks

Install

Is there a script that can give you the details of an installation for SQL server 2000. What connection mode was used...etc
Thanks
Hi,
Have a look into serverproperty function in books online, But the
authentication mode can not selected using this function.
FYI, The authentication mode of SQL Server is stored in the registry, so you
need read the registry to check the authentication. Use the extended
procedure xp_regread to read the registry and get the authentication mode.
Thanks
Hari
MCDBA
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:27BA378C-E2BA-4ECD-8BF9-7B0C31959B78@.microsoft.com...
> Is there a script that can give you the details of an installation for SQL
server 2000. What connection mode was used...etc
> Thanks
|||The install details for SQL Server are stored in a file called SQLSTP.log...
You will find it in the windows directory...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:27BA378C-E2BA-4ECD-8BF9-7B0C31959B78@.microsoft.com...
> Is there a script that can give you the details of an installation for SQL
server 2000. What connection mode was used...etc
> Thanks

Friday, February 24, 2012

Inserting sql script

Hi, I was wondering if anyone knows how to import an sql script to the MSSQL server using the SQL Server enterprise manager? I have some scripts that I want to use and I don't want to manually create the database if I have the scripts.You can use Query Analyzer for these types of activities

Sunday, February 19, 2012

Inserting Null Value

Is there a way, I can insert NULL value to "DT_Date" type Row Column using Script Component Transformation of Data flow?

Ie. I have a column named Ordered Date which is type DT_Date. Based on some condition within a script component task, I want to set the value to NULL, however, since the type is date it will not allow nulls.

Found the answer, it was fairly simple. Row.FieldName_ISNULL() property is a read/write property. This property can be used to set nulls.

|||I'm assuming you are also doing some other work in the Script, but I thought I would mention that you can also do this in the Derived Column transform with the NULL() function. In your case, NULL(DT_DATE).|||Let me just add that the <columnname>_IsNull property may be read/write, or may be read-only, depending on the corresponding Usage Type specified for the individual column.

-Doug
|||

I have a simple package that takes data from excel sources, runs a Data Transformation to get the decimal conversion etc into the same format as SQL ... but some of the columns are nullable - so my Data Transformation fails when it hits a null value in the source... (converting from float in the source to decimal in the destination.. though becuase of the empty values it sees the source as a string). Seems like it should be simple to allow it to pass nulls but I can't seem to figure it out (am new to SSIS). None of the fields in the transformation appear to be editable so that I can add the NULL() as mentioned above - if I got into the Advanced editor I can manually type the data type but NULL(DT_DECIMAL) gives me error "DataTypeConverter cannot convert from System.String."

Can anyone point me in the right direction? :)

|||

<<a Data Transformation to get the decimal conversion etc into the same format as SQL >>

I believe your problem is in the decimal conversion processing you mention. The expression - or code - should be written to handle the occurence of nulls without bombing...

|||

That is just it... I am not "writing" anything - its not a script component transformation task but rather just a "Data Conversion" object. If you edit the Data Conversion object it has input and then output... you can change the output alias, datatype, scale, codepage etc but there isn't any options regarding nulls that I can find.

|||

So the problem is that the source data looks like an empty string, and in that case you want to put NULL in the destination? You might try using a Derived Column instead of the Data Conversion. There, you can write an expression.

For example, if your string input column is named "InputCol", and you are converting to DT_DECIMAL with scale 10, your expression for the new column would look like:

LEN(InputCol) == 0 ? NULL(DT_DECIMAL, 10) : (DT_DECIMAL, 10)InputCol

Let me know if that helps.

Mark

Inserting Null Value

Is there a way, I can insert NULL value to "DT_Date" type Row Column using Script Component Transformation of Data flow?

Ie. I have a column named Ordered Date which is type DT_Date. Based on some condition within a script component task, I want to set the value to NULL, however, since the type is date it will not allow nulls.

Found the answer, it was fairly simple. Row.FieldName_ISNULL() property is a read/write property. This property can be used to set nulls.

|||I'm assuming you are also doing some other work in the Script, but I thought I would mention that you can also do this in the Derived Column transform with the NULL() function. In your case, NULL(DT_DATE).|||Let me just add that the <columnname>_IsNull property may be read/write, or may be read-only, depending on the corresponding Usage Type specified for the individual column.

-Doug
|||

I have a simple package that takes data from excel sources, runs a Data Transformation to get the decimal conversion etc into the same format as SQL ... but some of the columns are nullable - so my Data Transformation fails when it hits a null value in the source... (converting from float in the source to decimal in the destination.. though becuase of the empty values it sees the source as a string). Seems like it should be simple to allow it to pass nulls but I can't seem to figure it out (am new to SSIS). None of the fields in the transformation appear to be editable so that I can add the NULL() as mentioned above - if I got into the Advanced editor I can manually type the data type but NULL(DT_DECIMAL) gives me error "DataTypeConverter cannot convert from System.String."

Can anyone point me in the right direction? :)

|||

<<a Data Transformation to get the decimal conversion etc into the same format as SQL >>

I believe your problem is in the decimal conversion processing you mention. The expression - or code - should be written to handle the occurence of nulls without bombing...

|||

That is just it... I am not "writing" anything - its not a script component transformation task but rather just a "Data Conversion" object. If you edit the Data Conversion object it has input and then output... you can change the output alias, datatype, scale, codepage etc but there isn't any options regarding nulls that I can find.

|||

So the problem is that the source data looks like an empty string, and in that case you want to put NULL in the destination? You might try using a Derived Column instead of the Data Conversion. There, you can write an expression.

For example, if your string input column is named "InputCol", and you are converting to DT_DECIMAL with scale 10, your expression for the new column would look like:

LEN(InputCol) == 0 ? NULL(DT_DECIMAL, 10) : (DT_DECIMAL, 10)InputCol

Let me know if that helps.

Mark