Showing posts with label manager. Show all posts
Showing posts with label manager. Show all posts

Friday, March 30, 2012

How to create report parameter programmatically?

Hi,

I'm working on custom report manager. It manages "report entities" and

"report templates" (actually, RDLs uploaded on the server) and stores

one-to-many relation between them. The task is to store

"MasterEntityID" report parameter in every RDL and keep it up in actual

state whether RDL is being assigned to another entity or new RDL is

being uploaded and assigned. I've covered the first issue with

SetReportParameters() web method, but how should I deal with the second

one? Uploaded RDL may be short of the param, so I have to add it

programmatically while uploading.

Thanks,

AnatolyWhat exactly is the second issue? it looks like you have a custom application layer which can have complete control over the parameters.|||Yes, but actually I'm interested in adding new report parameter via web service. My application should do this if a developer of the uploading report hasn't defined necessary parameter manually. Is it possible?|||

The new parameter must be added to the report definition under the <ReportParameters> element. SetReportParameters won't let you configure the new parameter if it is not prior added to the report definition. This makes sense considering that you will probably need also to link the parameter to the report query. In fact, you won't need SetReportParameters for new parameters b/c once you add the parameter to RDL and call SetReportDefinition, the parameter will be created automatically for you.

As a side note, if you your application requires extensive reading/writing to RDL, you may benefit from buidling an object model on top of RDL that knows how to deserialize/serialize from/to RDL to avoid tedious XMLDOM programming and XPATH references.

|||

Teo, thanks for your clear reply. I'd think of object model. Mostly because I'm going to generate some rdl templates (with datasources, datasets and queries definitions) programmatically in future.

Thank you once again and Happy New Year!)

|||Happy New Year to you too.

Wednesday, March 28, 2012

How to create new database in sql server 2005

Hello Friends,
I am using sql server 2005 and cant find a way to create and / or view databases.
In sql server 2000, there was enterprise manager to display sql registrations and connections.. How sql server 2005 differs from it.
Please help me.

If you are using SQL Server 2005 Express, you have noticed that it does not install any client tools, such as 'EnterPrise Mangler'.

For SQL Server 2005 Express, you can download SQL Server Management Studio Express from here. (SSMS is the replacement for Enterprise Manager.)

Monday, March 26, 2012

How to create image field?

Hello,
I would like to store some images in an msde table. When I go into the
enterprise manager design table mode and pick image as a field type, it
defaults to 16 bytes in size, and doesn't allow me to change the size. I
can't create a varbinary field greater than 8000 bytes either. The msde
instance is a recent install downloaded fresh from Microsoft, so it is the
current version (but for the life of me I can't figure out how to determine
the version #).
I've also tried using a shareware package called MSDE manager, but with the
same results.
How do I create an image field of 50K, for example?
thanks
Marc Pelletier
Hi,
It is not an issue, By default it will take bytes. Image data type will
allow you store a maximum of 2 GB. No need to change any thing
VARBINARY will allow a maximum of bytes.
Thanks
Hari
SQL Server MVP
"Marc Pelletier" <no.email@.please.com> wrote in message
news:Xns959A92CA0DCBAmpdd445@.216.168.3.44...
> Hello,
> I would like to store some images in an msde table. When I go into the
> enterprise manager design table mode and pick image as a field type, it
> defaults to 16 bytes in size, and doesn't allow me to change the size. I
> can't create a varbinary field greater than 8000 bytes either. The msde
> instance is a recent install downloaded fresh from Microsoft, so it is the
> current version (but for the life of me I can't figure out how to
> determine
> the version #).
> I've also tried using a shareware package called MSDE manager, but with
> the
> same results.
> How do I create an image field of 50K, for example?
> thanks
> Marc Pelletier
|||"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in news:eFR6PmUxEHA.1264
@.TK2MSFTNGP12.phx.gbl:

> It is not an issue, By default it will take bytes. Image data type will
> allow you store a maximum of 2 GB. No need to change any thing
> VARBINARY will allow a maximum of bytes.
>
I don't mean to look a gift horse in the mouth, but you haven't told me
anything. Do you mean to say that even though it appears to be 16 bytes, I
can actually stuff whatever I want in there? That doesn't seem likely.
cheers
Marc Pelletier
|||> I don't mean to look a gift horse in the mouth, but you haven't told me
> anything. Do you mean to say that even though it appears to be 16 bytes, I
> can actually stuff whatever I want in there? That doesn't seem likely.
Stop looking at enterprise manager to "tell you anything." The 16 bytes
represents a pointer to the data, not the actual data. Hari was not lying
when he said that you can store ~2 GB of data in there...
|||Typically, all that is stored in the data row for image, text, or ntext
columns is a 16 byte pointer to where the actual data is stored. You can
store up to 2GB of data for each data value using these data types.
For more information about how the data for these data types are stored,
see:
http://msdn.microsoft.com/library/?u...asp?frame=true
http://msdn.microsoft.com/library/?u...asp?frame=true
http://msdn.microsoft.com/library/?u...asp?frame=true
Alan Brewer [MSFT]
Content Architect
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
|||"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
news:#l6OeKbxEHA.2876@.TK2MSFTNGP12.phx.gbl:

> Stop looking at enterprise manager to "tell you anything." The 16
> bytes represents a pointer to the data, not the actual data. Hari was
> not lying when he said that you can store ~2 GB of data in there...
>
Ok, thanks, I didn't think he was lying ( and if I gave that impression,
sorry). That being the case, how come varbinary allows me to set the size
up to 8000, when it also has a limit of ~2G? How would I define my field
to store a large amount of data?
I'm guessing that under the hood they are essentially the same type,
since I could stream any binary data into an image field anyway, couldn't
I?
thanks
Marc Pelletier
|||> sorry). That being the case, how come varbinary allows me to set the size
> up to 8000, when it also has a limit of ~2G?
Who said varbinary has a limit of ~2 GB?

> How would I define my field
> to store a large amount of data?
Using the IMAGE datatype, not VARBINARY.

> I'm guessing that under the hood they are essentially the same type,
> since I could stream any binary data into an image field anyway, couldn't
> I?
I'm not going to presume to know exactly how the engine works with these
types. But I know that they are stored at least slightly differently,
similar to VARCHAR(8000) and TEXT (even though, deep down, they are both
just storing text).
|||"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
news:O0zalzcxEHA.2568@.TK2MSFTNGP10.phx.gbl:

> Who said varbinary has a limit of ~2 GB?
>
Well... I did. But I shouldn't have. If it isn't clear already, I'm new to
sql server. I generally vigorously avoid database programming, but can't
avoid it for my current project.
Thanks for the help, everyone. I think I'm away for now.
Marc
|||Hello,
I am new to databases. But i dont understand how one could store a picture
in a cell in a database? Or do you mean that there is a link to the picture
in the cell?
Thanks
WStoreyII
"Marc Pelletier" wrote:

> Hello,
> I would like to store some images in an msde table. When I go into the
> enterprise manager design table mode and pick image as a field type, it
> defaults to 16 bytes in size, and doesn't allow me to change the size. I
> can't create a varbinary field greater than 8000 bytes either. The msde
> instance is a recent install downloaded fresh from Microsoft, so it is the
> current version (but for the life of me I can't figure out how to determine
> the version #).
> I've also tried using a shareware package called MSDE manager, but with the
> same results.
> How do I create an image field of 50K, for example?
> thanks
> Marc Pelletier
>
|||=?Utf-8?B?V1N0b3JleUlJ?= <WStoreyII@.discussions.microsoft.com> wrote in
news:54836FEC-DDCB-4F80-85F0-13F580D4C292@.microsoft.com:

> I am new to databases. But i dont understand how one could store a
> picture in a cell in a database? Or do you mean that there is a link
> to the picture in the cell?
>
WStorey,
The image is stored as a binary stream directly in a blob (binary large
object, I think ) field of the database. It adds a substantial overhead to
the process, and I think that in many cases it is better to store the image
on disk and store a reference to it in the db, as you have suggested.
However it is what I am going to do. In my case the number ( and size) of
images will be fairly small and dynamic, maybe a couple of thousand, and
will be accessed a lot, so I expext the sql server cacheing to help with
the performance hit.
The how is explained quite clearly in
http://support.microsoft.com/default...en-us;309158#1
for the csharp case.
Hope this helps.
Marc Pelletier

How to create database from script file?

Hi
I use SQLServer 2000 with SP3
I have script file that has been created using "generate SQL script"
command from SQL server Enterprise manager.
But I can't find how to create database using this script file. Is there
any way to create database from script file?
I appreciate your help!Copy the script to the clipboard during the "generate sql script" command.
Start the query analyzer and past the script
Run the script.
(You could also save the script and open it in the query analyzer)
Nico De Greef
Belgium
Freelance Software Architect
MCP, MCSD, .NET certified
"JK" <invalid@.address> wrote in message
news:e0JzX2Q$DHA.808@.TK2MSFTNGP12.phx.gbl...
> Hi
> I use SQLServer 2000 with SP3
> I have script file that has been created using "generate SQL script"
> command from SQL server Enterprise manager.
> But I can't find how to create database using this script file. Is there
> any way to create database from script file?
>
> I appreciate your help!
>|||In the Options tab of generate script, you have the option to "Script
Database". This will include the CREATE DATABASE statement.
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=...ublic.sqlserver
"JK" <invalid@.address> wrote in message
news:e0JzX2Q$DHA.808@.TK2MSFTNGP12.phx.gbl...
> Hi
> I use SQLServer 2000 with SP3
> I have script file that has been created using "generate SQL script"
> command from SQL server Enterprise manager.
> But I can't find how to create database using this script file. Is there
> any way to create database from script file?
>
> I appreciate your help!
>sql

Friday, March 23, 2012

How to create database from script file?

Hi
I use SQLServer 2000 with SP3
I have script file that has been created using "generate SQL script"
command from SQL server Enterprise manager.
But I can't find how to create database using this script file. Is there
any way to create database from script file?
I appreciate your help!check out www.dbghost.com
>--Original Message--
>Hi
>I use SQLServer 2000 with SP3
>I have script file that has been created using "generate
SQL script"
>command from SQL server Enterprise manager.
>But I can't find how to create database using this
script file. Is there
>any way to create database from script file?
>
>I appreciate your help!
>
>.
>|||Copy the script to the clipboard during the "generate sql script" command.
Start the query analyzer and past the script
Run the script.
(You could also save the script and open it in the query analyzer)
--
Nico De Greef
Belgium
Freelance Software Architect
MCP, MCSD, .NET certified
"JK" <invalid@.address> wrote in message
news:e0JzX2Q$DHA.808@.TK2MSFTNGP12.phx.gbl...
> Hi
> I use SQLServer 2000 with SP3
> I have script file that has been created using "generate SQL script"
> command from SQL server Enterprise manager.
> But I can't find how to create database using this script file. Is there
> any way to create database from script file?
>
> I appreciate your help!
>|||In the Options tab of generate script, you have the option to "Script
Database". This will include the CREATE DATABASE statement.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"JK" <invalid@.address> wrote in message
news:e0JzX2Q$DHA.808@.TK2MSFTNGP12.phx.gbl...
> Hi
> I use SQLServer 2000 with SP3
> I have script file that has been created using "generate SQL script"
> command from SQL server Enterprise manager.
> But I can't find how to create database using this script file. Is there
> any way to create database from script file?
>
> I appreciate your help!
>

How to create configurations ?

When I attempt to create a new configuration named QA in
configuration manager.
I enter QA in the Solution Configuration Name and copy
setting from <Default>. I also select the checkbox "Also
create new project configuration". After pressing the OK
button, I cannot find the new configuration QA in the list.
Besides, I would like to know what does it mean for the
configuration - Does it mean that the different Report
Servers OR different folders in the same Report Server ?
ThanksSQL 2000 Reporting Services does not support creating new project
configurations. You can create a new solution configuration if you uncheck
"Also create new project configuration". To create a new project
configuration you need to edit the project file (*.rptproj).
The project configuration contains all the project properties: TargetFolder,
TargetServerURL and OverwriteDataSources.
--
Albert Yen
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:141b01c56b0d$42a6ed30$a401280a@.phx.gbl...
> When I attempt to create a new configuration named QA in
> configuration manager.
> I enter QA in the Solution Configuration Name and copy
> setting from <Default>. I also select the checkbox "Also
> create new project configuration". After pressing the OK
> button, I cannot find the new configuration QA in the list.
> Besides, I would like to know what does it mean for the
> configuration - Does it mean that the different Report
> Servers OR different folders in the same Report Server ?
> Thanks

Wednesday, March 21, 2012

How to create an excel connection manager programmatically ?

I am following the samples in the online books. I've got an OLEDB connection manager and source component defined. I now want to create an Excel connection manager and destination component (see below). How can I do this?

Dim conMgr As ConnectionManager = package.Connections.Add("OLEDB")

conMgr.ConnectionString = "Provider=SQLOLEDB.1;" "Data Source=FLL-EIS;Initial Catalog=DataLoad;" & _

"Integrated Security=SSPI;"

conMgr.Name = "SSIS Connection Manager for OLE DB"

conMgr.Description = "OLE DB connection to FLL-EIS."

' Create and configure an OLE DB source component.

Dim source As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

source.ComponentClassID = "DTSAdapter.OleDbSource"

' Create the design-time instance of the source.

Dim srcDesignTime As CManagedComponentWrapper = source.Instantiate

srcDesignTime.ProvideComponentProperties()

' Assign the connection manager.

source.RuntimeConnectionCollection(0).ConnectionManager = _

DtsConvert.ToConnectionManager90(conMgr)

' Set the custom properties of the source.

srcDesignTime.SetComponentProperty("AccessMode", 2)

srcDesignTime.SetComponentProperty("SqlCommand", Dts.Variables("User::gsQuery").Value.ToString)

' Connect to the data source,

' and then update the metadata for the source.

srcDesignTime.AcquireConnections(Nothing)

srcDesignTime.ReinitializeMetaData()

srcDesignTime.ReleaseConnections()

' Create and configure an OLE DB destination. (This is where I need help, as this code does not work)

Dim destination As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

destination.ComponentClassID = "DTSAdapter.ExcelDestination"

' Create the design-time instance of the destination.

Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate

' Where can I find documentation about the various ComponentClassIds and Properties?

destDesignTime.ProvideComponentProperties()

destDesignTime.SetComponentProperty("ExcelFilePath", Dts.Variables("User::gsExcelFile").Value.ToString)

destDesignTime.SetComponentProperty("TableName", Dts.Variables("User::gsSheetName").Value.ToString)

Here are a couple of wrapper functions I have for creating connections, including an Excel connection-

Code Snippet

private static ConnectionManager AddExcelConnection(Package package, string filename)

{

return AddConnection(package, "EXCEL", String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES\"", filename));

}

private static ConnectionManager AddSqlConnection(Package package, string server, string database)

{

return AddConnection(package, "OLEDB", String.Format("Provider=SQLOLEDB.1;Data Source={0};Persist Security Info=False;Initial Catalog={1};Integrated Security=SSPI;", server, database));

}

private static ConnectionManager AddConnection(Package package, string type, string connectionString)

{

ConnectionManager manager = package.Connections.Add(type);

manager.ConnectionString = connectionString;

manager.Name = String.Format("{0} Connection", type);

return manager;

}

Call it like this -

Code Snippet

Package package = new Package();

// Add the Excel connection

ConnectionManager excelConnection = AddExcelConnection(package, @."C:\Temp\Export.xls");

Is your destination code correct? I the properties look wrong, I always used -

componentInstance.SetComponentProperty("AccessMode", 2);

componentInstance.SetComponentProperty("SqlCommand", query);

|||

Thanks for the info, Darren. So, now I have the following code, but how do I specify the destination table (sheet) name?

Dim conDest As ConnectionManager = package.Connections.Add("Excel")

conDest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Dts.Variables("User::gsExcelFile").Value.ToString & ";Extended Properties=""Excel 8.0;HDR=YES"""

|||

Code Snippet

componentInstance.SetComponentProperty("AccessMode", 0);

componentInstance.SetComponentProperty("OpenRowset", sheetName);

I was wrong above, it is OpenRowset for teh table/sheet not SqlCommand.

|||

Thanks for the reply, Darren. The first SetComponentProperty worked, but not the second, which gets a runtime exception. Is the property under a different name? Thanks for your help!

' Create and configure an OLE DB destination.

Dim conDest As ConnectionManager = package.Connections.Add("Excel")

conDest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Dts.Variables("User::gsExcelFile").Value.ToString & ";Extended Properties=""Excel 8.0;HDR=YES"""

conDest.Name = "Excel File"

conDest.Description = "Excel File"

Dim destination As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

destination.ComponentClassID = "DTSAdapter.ExcelDestination"

' Create the design-time instance of the destination.

Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate

' The ProvideComponentProperties method creates a default input.

destDesignTime.ProvideComponentProperties()

destination.RuntimeConnectionCollection(0).ConnectionManager = DtsConvert.ToConnectionManager90(conDest)

destDesignTime.SetComponentProperty("AccessMode", 0)

'runtime Exception here

destDesignTime.SetComponentProperty("OpenRowSet", "functions")

|||http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2175638&SiteID=1

How to create an excel connection manager programmatically ?

I am following the samples in the online books. I've got an OLEDB connection manager and source component defined. I now want to create an Excel connection manager and destination component (see below). How can I do this?

Dim conMgr As ConnectionManager = package.Connections.Add("OLEDB")

conMgr.ConnectionString = "Provider=SQLOLEDB.1;" "Data Source=FLL-EIS;Initial Catalog=DataLoad;" & _

"Integrated Security=SSPI;"

conMgr.Name = "SSIS Connection Manager for OLE DB"

conMgr.Description = "OLE DB connection to FLL-EIS."

' Create and configure an OLE DB source component.

Dim source As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

source.ComponentClassID = "DTSAdapter.OleDbSource"

' Create the design-time instance of the source.

Dim srcDesignTime As CManagedComponentWrapper = source.Instantiate

srcDesignTime.ProvideComponentProperties()

' Assign the connection manager.

source.RuntimeConnectionCollection(0).ConnectionManager = _

DtsConvert.ToConnectionManager90(conMgr)

' Set the custom properties of the source.

srcDesignTime.SetComponentProperty("AccessMode", 2)

srcDesignTime.SetComponentProperty("SqlCommand", Dts.Variables("User::gsQuery").Value.ToString)

' Connect to the data source,

' and then update the metadata for the source.

srcDesignTime.AcquireConnections(Nothing)

srcDesignTime.ReinitializeMetaData()

srcDesignTime.ReleaseConnections()

' Create and configure an OLE DB destination. (This is where I need help, as this code does not work)

Dim destination As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

destination.ComponentClassID = "DTSAdapter.ExcelDestination"

' Create the design-time instance of the destination.

Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate

' Where can I find documentation about the various ComponentClassIds and Properties?

destDesignTime.ProvideComponentProperties()

destDesignTime.SetComponentProperty("ExcelFilePath", Dts.Variables("User::gsExcelFile").Value.ToString)

destDesignTime.SetComponentProperty("TableName", Dts.Variables("User::gsSheetName").Value.ToString)

Here are a couple of wrapper functions I have for creating connections, including an Excel connection-

Code Snippet

private static ConnectionManager AddExcelConnection(Package package, string filename)

{

return AddConnection(package, "EXCEL", String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES\"", filename));

}

private static ConnectionManager AddSqlConnection(Package package, string server, string database)

{

return AddConnection(package, "OLEDB", String.Format("Provider=SQLOLEDB.1;Data Source={0};Persist Security Info=False;Initial Catalog={1};Integrated Security=SSPI;", server, database));

}

private static ConnectionManager AddConnection(Package package, string type, string connectionString)

{

ConnectionManager manager = package.Connections.Add(type);

manager.ConnectionString = connectionString;

manager.Name = String.Format("{0} Connection", type);

return manager;

}

Call it like this -

Code Snippet

Package package = new Package();

// Add the Excel connection

ConnectionManager excelConnection = AddExcelConnection(package, @."C:\Temp\Export.xls");

Is your destination code correct? I the properties look wrong, I always used -

componentInstance.SetComponentProperty("AccessMode", 2);

componentInstance.SetComponentProperty("SqlCommand", query);

|||

Thanks for the info, Darren. So, now I have the following code, but how do I specify the destination table (sheet) name?

Dim conDest As ConnectionManager = package.Connections.Add("Excel")

conDest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Dts.Variables("User::gsExcelFile").Value.ToString & ";Extended Properties=""Excel 8.0;HDR=YES"""

|||

Code Snippet

componentInstance.SetComponentProperty("AccessMode", 0);

componentInstance.SetComponentProperty("OpenRowset", sheetName);

I was wrong above, it is OpenRowset for teh table/sheet not SqlCommand.

|||

Thanks for the reply, Darren. The first SetComponentProperty worked, but not the second, which gets a runtime exception. Is the property under a different name? Thanks for your help!

' Create and configure an OLE DB destination.

Dim conDest As ConnectionManager = package.Connections.Add("Excel")

conDest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Dts.Variables("User::gsExcelFile").Value.ToString & ";Extended Properties=""Excel 8.0;HDR=YES"""

conDest.Name = "Excel File"

conDest.Description = "Excel File"

Dim destination As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

destination.ComponentClassID = "DTSAdapter.ExcelDestination"

' Create the design-time instance of the destination.

Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate

' The ProvideComponentProperties method creates a default input.

destDesignTime.ProvideComponentProperties()

destination.RuntimeConnectionCollection(0).ConnectionManager = DtsConvert.ToConnectionManager90(conDest)

destDesignTime.SetComponentProperty("AccessMode", 0)

'runtime Exception here

destDesignTime.SetComponentProperty("OpenRowSet", "functions")

|||http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2175638&SiteID=1

How to create an excel connection manager programmatically ?

I am following the samples in the online books. I've got an OLEDB connection manager and source component defined. I now want to create an Excel connection manager and destination component (see below). How can I do this?

Dim conMgr As ConnectionManager = package.Connections.Add("OLEDB")

conMgr.ConnectionString = "Provider=SQLOLEDB.1;" "Data Source=FLL-EIS;Initial Catalog=DataLoad;" & _

"Integrated Security=SSPI;"

conMgr.Name = "SSIS Connection Manager for OLE DB"

conMgr.Description = "OLE DB connection to FLL-EIS."

' Create and configure an OLE DB source component.

Dim source As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

source.ComponentClassID = "DTSAdapter.OleDbSource"

' Create the design-time instance of the source.

Dim srcDesignTime As CManagedComponentWrapper = source.Instantiate

srcDesignTime.ProvideComponentProperties()

' Assign the connection manager.

source.RuntimeConnectionCollection(0).ConnectionManager = _

DtsConvert.ToConnectionManager90(conMgr)

' Set the custom properties of the source.

srcDesignTime.SetComponentProperty("AccessMode", 2)

srcDesignTime.SetComponentProperty("SqlCommand", Dts.Variables("User::gsQuery").Value.ToString)

' Connect to the data source,

' and then update the metadata for the source.

srcDesignTime.AcquireConnections(Nothing)

srcDesignTime.ReinitializeMetaData()

srcDesignTime.ReleaseConnections()

' Create and configure an OLE DB destination. (This is where I need help, as this code does not work)

Dim destination As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

destination.ComponentClassID = "DTSAdapter.ExcelDestination"

' Create the design-time instance of the destination.

Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate

' Where can I find documentation about the various ComponentClassIds and Properties?

destDesignTime.ProvideComponentProperties()

destDesignTime.SetComponentProperty("ExcelFilePath", Dts.Variables("User::gsExcelFile").Value.ToString)

destDesignTime.SetComponentProperty("TableName", Dts.Variables("User::gsSheetName").Value.ToString)

Here are a couple of wrapper functions I have for creating connections, including an Excel connection-

Code Snippet

private static ConnectionManager AddExcelConnection(Package package, string filename)

{

return AddConnection(package, "EXCEL", String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES\"", filename));

}

private static ConnectionManager AddSqlConnection(Package package, string server, string database)

{

return AddConnection(package, "OLEDB", String.Format("Provider=SQLOLEDB.1;Data Source={0};Persist Security Info=False;Initial Catalog={1};Integrated Security=SSPI;", server, database));

}

private static ConnectionManager AddConnection(Package package, string type, string connectionString)

{

ConnectionManager manager = package.Connections.Add(type);

manager.ConnectionString = connectionString;

manager.Name = String.Format("{0} Connection", type);

return manager;

}

Call it like this -

Code Snippet

Package package = new Package();

// Add the Excel connection

ConnectionManager excelConnection = AddExcelConnection(package, @."C:\Temp\Export.xls");

Is your destination code correct? I the properties look wrong, I always used -

componentInstance.SetComponentProperty("AccessMode", 2);

componentInstance.SetComponentProperty("SqlCommand", query);

|||

Thanks for the info, Darren. So, now I have the following code, but how do I specify the destination table (sheet) name?

Dim conDest As ConnectionManager = package.Connections.Add("Excel")

conDest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Dts.Variables("User::gsExcelFile").Value.ToString & ";Extended Properties=""Excel 8.0;HDR=YES"""

|||

Code Snippet

componentInstance.SetComponentProperty("AccessMode", 0);

componentInstance.SetComponentProperty("OpenRowset", sheetName);

I was wrong above, it is OpenRowset for teh table/sheet not SqlCommand.

|||

Thanks for the reply, Darren. The first SetComponentProperty worked, but not the second, which gets a runtime exception. Is the property under a different name? Thanks for your help!

' Create and configure an OLE DB destination.

Dim conDest As ConnectionManager = package.Connections.Add("Excel")

conDest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Dts.Variables("User::gsExcelFile").Value.ToString & ";Extended Properties=""Excel 8.0;HDR=YES"""

conDest.Name = "Excel File"

conDest.Description = "Excel File"

Dim destination As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New

destination.ComponentClassID = "DTSAdapter.ExcelDestination"

' Create the design-time instance of the destination.

Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate

' The ProvideComponentProperties method creates a default input.

destDesignTime.ProvideComponentProperties()

destination.RuntimeConnectionCollection(0).ConnectionManager = DtsConvert.ToConnectionManager90(conDest)

destDesignTime.SetComponentProperty("AccessMode", 0)

'runtime Exception here

destDesignTime.SetComponentProperty("OpenRowSet", "functions")

|||http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2175638&SiteID=1sql

Monday, March 19, 2012

how to create a partitioned table?

Hi,

How to create a partitioned table(not view) in enterprise manager and T-SQL?

Thanks,

It sounds like you're talking about SQL2000. In SQL2000, the only way you can do it is to have multiple tables and a view which makes it look like a single one.

In SQL2005, sure... the standard example is:

CREATE PARTITION FUNCTION myRangePF1 (int)
AS RANGE LEFT FOR VALUES (1, 100, 1000) ;
GO
CREATE PARTITION SCHEME myRangePS1
AS PARTITION myRangePF1
TO (test1fg, test2fg, test3fg, test4fg) ;
GO
CREATE TABLE PartitionTable (col1 int, col2 char(10))
ON myRangePS1 (col1) ;
GO

Hope this helps...

Rob

Monday, March 12, 2012

How to create a new SQL account that just has rights to a specific database?

Gurus,
You know how in SQL Enterprise Manager you click on Databases node and see
all the databases? And that the SA account has full access to all of these?
Well, if, from here on out, I wanted to create a database that beside the SA
account had a separate account that had public and DB owner rights on it,
how would I create such a SQL account? I guess what I am asking is how to
create new SQL accounts.
--
SpinHi
Check out the topic "Managing Security" in Books Online. To add a login to
your server see sp_grantlogin. To grant access to a database use
sp_grantdbaccess, to add users to a role see sp_addrolemember.
John
"Spin" wrote:
> Gurus,
> You know how in SQL Enterprise Manager you click on Databases node and see
> all the databases? And that the SA account has full access to all of these?
> Well, if, from here on out, I wanted to create a database that beside the SA
> account had a separate account that had public and DB owner rights on it,
> how would I create such a SQL account? I guess what I am asking is how to
> create new SQL accounts.
> --
> Spin
>
>|||Can this be done via the GUI?
--
Spin
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:7783F616-4217-43D6-845A-B111A1DA042C@.microsoft.com...
> Hi
> Check out the topic "Managing Security" in Books Online. To add a login to
> your server see sp_grantlogin. To grant access to a database use
> sp_grantdbaccess, to add users to a role see sp_addrolemember.
> John
> "Spin" wrote:
>> Gurus,
>> You know how in SQL Enterprise Manager you click on Databases node and
>> see
>> all the databases? And that the SA account has full access to all of
>> these?
>> Well, if, from here on out, I wanted to create a database that beside the
>> SA
>> account had a separate account that had public and DB owner rights on it,
>> how would I create such a SQL account? I guess what I am asking is how
>> to
>> create new SQL accounts.
>> --
>> Spin
>>|||You first need to create a login for the account and then define the
account in the database. The general steps (In Enterprise Manager) are:
1) Expand the nodes on the left hand side of the console until you find
your SQL Server instance (e.g. \\CompName\InstanceName)
2) Expand the node for the instance & you should see a sub-node called
"Security". Expand the "Security" node and you should see a "Logins"
sub-node
3) Right click on the "Logins" node and select "New Login..." After
doing this the "New Login" window will appear
4) In the "New Login" window type in the name of the server login,
select the authentication type and set the default database (you
shouldn't need to worry about the default language)
5) Inthe "New Login" window, click on the "Database Access" tab to
bring up a list of databases on the server
6) Check the "Permit" text box next to the database you want to give
access to. A name for the user (same as the server login defined
previously) will appear next to the database name...Generally no need
to change this
NOTE: By default the server login will have access to a database on the
server IF the database has the "guest" account in it. If there is no
guest account then you need to explicitly give access as I've detailed
just now.
7) You'll notice in the bottom of the window that there is a list of
database roles. Your user will be in the "Public" role by default.
Select whatever roles are necessary.
8) That should be about it. Click OK to complete the process.
After doing the above steps you will have a server login that people
can use. This will have access to the database(s) you granted access to
in Step (6) with an access level as per the permissions you granted in
Step (7).
Hope that helps a little.|||That's great. With those steps, I do not need to go through the process of
sp_grantlogin, sp_grantdbaccess, and sp_addrolemember I take it?
Spin
<nate.vu@.gmail.com> wrote in message
news:1146956260.908362.69190@.i40g2000cwc.googlegroups.com...
> You first need to create a login for the account and then define the
> account in the database. The general steps (In Enterprise Manager) are:
> 1) Expand the nodes on the left hand side of the console until you find
> your SQL Server instance (e.g. \\CompName\InstanceName)
> 2) Expand the node for the instance & you should see a sub-node called
> "Security". Expand the "Security" node and you should see a "Logins"
> sub-node
> 3) Right click on the "Logins" node and select "New Login..." After
> doing this the "New Login" window will appear
> 4) In the "New Login" window type in the name of the server login,
> select the authentication type and set the default database (you
> shouldn't need to worry about the default language)
> 5) Inthe "New Login" window, click on the "Database Access" tab to
> bring up a list of databases on the server
> 6) Check the "Permit" text box next to the database you want to give
> access to. A name for the user (same as the server login defined
> previously) will appear next to the database name...Generally no need
> to change this
> NOTE: By default the server login will have access to a database on the
> server IF the database has the "guest" account in it. If there is no
> guest account then you need to explicitly give access as I've detailed
> just now.
> 7) You'll notice in the bottom of the window that there is a list of
> database roles. Your user will be in the "Public" role by default.
> Select whatever roles are necessary.
> 8) That should be about it. Click OK to complete the process.
> After doing the above steps you will have a server login that people
> can use. This will have access to the database(s) you granted access to
> in Step (6) with an access level as per the permissions you granted in
> Step (7).
> Hope that helps a little.
>|||Yes, that's correct...The above steps are for the GUI (Enterprise
Manager if you're on SQL Server 2000). Calling the stored procs is the
equivalent way of doing it by using T-SQL statements and using
something like Query Analyzer to execute them.
Both methods will achieve the same results.
Hope that helps a little.|||Hi
If you need to do this regularly then it will be a lot quicker if you use a
script and query analyser. The section on managing security in Books Online
will give you background information as well as tell you the different ways
of carrying out these activities this includes how to use Enterprise Manager.
John
"Spin" wrote:
> That's great. With those steps, I do not need to go through the process of
> sp_grantlogin, sp_grantdbaccess, and sp_addrolemember I take it?
>
> --
> Spin
>
> <nate.vu@.gmail.com> wrote in message
> news:1146956260.908362.69190@.i40g2000cwc.googlegroups.com...
> > You first need to create a login for the account and then define the
> > account in the database. The general steps (In Enterprise Manager) are:
> >
> > 1) Expand the nodes on the left hand side of the console until you find
> > your SQL Server instance (e.g. \\CompName\InstanceName)
> >
> > 2) Expand the node for the instance & you should see a sub-node called
> > "Security". Expand the "Security" node and you should see a "Logins"
> > sub-node
> >
> > 3) Right click on the "Logins" node and select "New Login..." After
> > doing this the "New Login" window will appear
> >
> > 4) In the "New Login" window type in the name of the server login,
> > select the authentication type and set the default database (you
> > shouldn't need to worry about the default language)
> >
> > 5) Inthe "New Login" window, click on the "Database Access" tab to
> > bring up a list of databases on the server
> >
> > 6) Check the "Permit" text box next to the database you want to give
> > access to. A name for the user (same as the server login defined
> > previously) will appear next to the database name...Generally no need
> > to change this
> >
> > NOTE: By default the server login will have access to a database on the
> > server IF the database has the "guest" account in it. If there is no
> > guest account then you need to explicitly give access as I've detailed
> > just now.
> >
> > 7) You'll notice in the bottom of the window that there is a list of
> > database roles. Your user will be in the "Public" role by default.
> > Select whatever roles are necessary.
> >
> > 8) That should be about it. Click OK to complete the process.
> >
> > After doing the above steps you will have a server login that people
> > can use. This will have access to the database(s) you granted access to
> > in Step (6) with an access level as per the permissions you granted in
> > Step (7).
> >
> > Hope that helps a little.
> >
>
>

How to create a group acct in reports manager just for browsing

How to create a group acct for just browsing the reports, this acct.

reports are hosted on internet and now would like to give the access to all users,

would like to use the same group acct. for all users.

when ever i try to access reports, i have to provide a windows uername and password. the same reports which are on an intranet environment does'nt ask for username and password. it seems like internet report site will ask for username and password and does'nt want to share the admin username and password.

Thank you all for the information.

Hi,

seems that the internet representation does not use integrated authentication. Therefore you will have to provide the credentials for connecting. What do you want to achieve within your solution ?

So, you want to let the user enter their individual credentials at the internet representation (then you will have to use Basic authentication or a certificate solution) or you you want to authenticate them with a generic user (then you will have to create a website / Virtual directory (this depends on your design) and configure the security for this directory indivudally to anonymous access. Provide the user account which will be impersonated for the accessing users in the settings of IIS)


HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

Friday, February 24, 2012

How to copy..........

I have 2 files with its same name (at folder C:\a\ and C:\b\, both Name
files is SData.mdf). I wanna access the files in enterprise manager at the
time. Can I do it? Because I wanna copy a object (table, store procedure,
etc) from C:\a\Sdata.mdf to C:\b\Sdata.mdf.
How to do it efficiently?Hi
You cannot 'access/open' them . Its data files SQL Server used for. RESTORE
DATABASE with a different names and make your copies
"Bpk. Adi Wira Kusuma" <adi_wira_kusuma@.yahoo.com.sg> wrote in message
news:eLt2paOTGHA.4384@.tk2msftngp13.phx.gbl...
>I have 2 files with its same name (at folder C:\a\ and C:\b\, both Name
> files is SData.mdf). I wanna access the files in enterprise manager at the
> time. Can I do it? Because I wanna copy a object (table, store procedure,
> etc) from C:\a\Sdata.mdf to C:\b\Sdata.mdf.
> How to do it efficiently?
>

Sunday, February 19, 2012

How to copy full txt catalogs from one db to another

How can yu copy full txt catalogs from one db to another.
I have tried to go the live db through enterprise manager,
right clicked, then generated a script, went to the
otpions and checked the indexes and saved the script. When
i tried to run that script in the new db, no catalogs are
showing. Is there anything i am doing wrong.Naz,
INF: How to Move, Copy, and Back Up Full-Text Catalog Folders and Files
http://www.support.microsoft.com/?id=240867
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Naz" <milnaz@.hotmail.com> wrote in message
news:44b501c37c6e$c49d0f20$a501280a@.phx.gbl...
> How can yu copy full txt catalogs from one db to another.
> I have tried to go the live db through enterprise manager,
> right clicked, then generated a script, went to the
> otpions and checked the indexes and saved the script. When
> i tried to run that script in the new db, no catalogs are
> showing. Is there anything i am doing wrong.