Showing posts with label store. Show all posts
Showing posts with label store. Show all posts

Sunday, March 11, 2012

Active Directory <-> SQL Integration ?

We have our user store in Active Directory. I am designing the data model
for some new applications, and a number of tables require fields such as
ApprovedBy, CreatedBy, etc. I want to be able to link these values back to
the Active Directory user store. I know I can just shove the AD user name i
n
there, but I want more. I want to have referential integrity between the tw
o
systems. Is this currently possible?
I'm going to assume it isn't possible, and if not is there a SQL Server wish
list/feedback email I can use to suggest this for a future product release?
I think this would be an extremely useful feature. (or if you could use SQL
Server as your Active Directory data store, that should solve the problem
also I believe, but I don't know if that is possible...).Hi
Check out the ADSI OLEDB provider.
http://msdn.microsoft.com/library/d...r />
_94fn.asp
If you can use check constraint that calls a function to implement RI, but
this sort of thing will probably prove prohibitably slow.
John
"Optikal" wrote:

> We have our user store in Active Directory. I am designing the data model
> for some new applications, and a number of tables require fields such as
> ApprovedBy, CreatedBy, etc. I want to be able to link these values back t
o
> the Active Directory user store. I know I can just shove the AD user name
in
> there, but I want more. I want to have referential integrity between the
two
> systems. Is this currently possible?
> I'm going to assume it isn't possible, and if not is there a SQL Server wi
sh
> list/feedback email I can use to suggest this for a future product release
?
> I think this would be an extremely useful feature. (or if you could use S
QL
> Server as your Active Directory data store, that should solve the problem
> also I believe, but I don't know if that is possible...).

Friday, February 24, 2012

Accessing URL

Hi!

I have two assets: a URL that points to an XML file, and a stored procedure that can accept this file as a text variable and store it in a SQL 2005 table.

create procedure [dbo].[insertObjects]

@.availabilityXml text

as

DECLARE @.xmlHndAdd INT

EXEC sp_xml_prepareDocument @.xmlHndAdd OUTPUT, @.availabilityXml

TRUNCATE TABLE Objects

INSERTObjects

SELECT *

FROM OPENXML(@.xmlHndAdd, '//NewDataSet/Table1', 2)
WITH Objects

Now, I need to find a solution to combine the URL with the proc.Does anyone have any suggestions on how I can pass my URL as a text variable to the procedure?SSIS, vb-script, etc. are welcome!

Thank you!

I believe these are your choices:

a) Store the data into a table through the URL and read it, this approach is mentioned here ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/dff99404-a002-48ee-910e-f37f013d946d.htm (Bulk Importing and Exporting XML Documents) in the SQL Server BOL.

b) Use OPENXML for loading data into a variable. This approach is given here: http://www.perfectxml.com/articles/xml/importxmlsql.asp#openxml

Hope this helps.

Thanks

Waseem

|||Thanks for the reply! I used the a approach, and it's working!|||Which approach did you use?|||OPENXML (b)

Accessing URL

Hi!

I have two assets: a URL that points to an XML file, and a stored procedure that can accept this file as a text variable and store it in a SQL 2005 table.

create procedure [dbo].[insertObjects]

@.availabilityXml text

as

DECLARE @.xmlHndAdd INT

EXEC sp_xml_prepareDocument @.xmlHndAdd OUTPUT, @.availabilityXml

TRUNCATE TABLE Objects

INSERTObjects

SELECT *

FROM OPENXML(@.xmlHndAdd, '//NewDataSet/Table1', 2)
WITH Objects

Now, I need to find a solution to combine the URL with the proc.Does anyone have any suggestions on how I can pass my URL as a text variable to the procedure?SSIS, vb-script, etc. are welcome!

Thank you!

I believe these are your choices:

a) Store the data into a table through the URL and read it, this approach is mentioned here ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/dff99404-a002-48ee-910e-f37f013d946d.htm (Bulk Importing and Exporting XML Documents) in the SQL Server BOL.

b) Use OPENXML for loading data into a variable. This approach is given here: http://www.perfectxml.com/articles/xml/importxmlsql.asp#openxml

Hope this helps.

Thanks

Waseem

|||Thanks for the reply! I used the a approach, and it's working!|||Which approach did you use?|||OPENXML (b)

Accessing URL

Hi!

I have two assets: a URL that points to an XML file, and a stored procedure that can accept this file as a text variable and store it in a SQL 2005 table.

create procedure [dbo].[insertObjects]

@.availabilityXml text

as

DECLARE @.xmlHndAdd INT

EXEC sp_xml_prepareDocument @.xmlHndAdd OUTPUT, @.availabilityXml

TRUNCATE TABLE Objects

INSERTObjects

SELECT *

FROM OPENXML(@.xmlHndAdd, '//NewDataSet/Table1', 2)
WITH Objects

Now, I need to find a solution to combine the URL with the proc.Does anyone have any suggestions on how I can pass my URL as a text variable to the procedure?SSIS, vb-script, etc. are welcome!

Thank you!

I believe these are your choices:

a) Store the data into a table through the URL and read it, this approach is mentioned here ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/dff99404-a002-48ee-910e-f37f013d946d.htm (Bulk Importing and Exporting XML Documents) in the SQL Server BOL.

b) Use OPENXML for loading data into a variable. This approach is given here: http://www.perfectxml.com/articles/xml/importxmlsql.asp#openxml

Hope this helps.

Thanks

Waseem

|||Thanks for the reply! I used the a approach, and it's working!|||Which approach did you use?|||OPENXML (b)

Sunday, February 12, 2012

accessing report programmatically

I need to run a report, output it in a CSV format, and store it in a
specified directory. I am able to do it using VS.net report designer.
How can I programmatically specify the output format and the
destination directory?
I'm new to RS, thanks for you help.Yes you can. There is a book by WROX called SQL Server Reporting Services.
It has a chapter on programmatic rendering. The book is a must have for
those learning SQL Server Report Services. It's very straight forward and
easy to implement.
David
"Mark" <maratg3@.hotmail.com> wrote in message
news:ffcd6d4.0410121336.5c27434e@.posting.google.com...
>I need to run a report, output it in a CSV format, and store it in a
> specified directory. I am able to do it using VS.net report designer.
> How can I programmatically specify the output format and the
> destination directory?
> I'm new to RS, thanks for you help.

Thursday, February 9, 2012

Accessing old reports

Once I get reports archived in History, it there a way I can get a pointer
of some kind to the report so I can store it in a database to facilitate
subsequent retrieval?
--
Regards,
Gary BlakelyHi Gary,
Thank you for your posting!
From your description, my understanding of this issue is: You want to view
the Report History. If I misunderstood your concern, please feel free to
let me know.
You could access the report history via URL:
For example:
http://server/reportserver?/SampleReports/Company
Sales&rs:Snapshot=2003-04-07T13:40:02
Also, you could manage the reporting history in the Report Manager and SQL
Management Studio (If you are using SQL Reporting Services 2005.)
Here is the article for your reference:
Managing Report History
http://msdn2.microsoft.com/en-us/library/ms155849.aspx
Hope this will be helpful!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Wei Lu,
Thanks for the response and that article will do me a lot of good.
However, I don't think we want the users accessing reporting services
directly. I was hoping to be able to have a "pointer" to a snapshot in
history and store that pointer in a database where it is related to other
data. the user would then be able to get old reports via the metaphor of
our application - they wouldn't even be aware of Reporting Services.
I have a wrox book on ssrs that says I can get a snapshot report by
specifying:
http://server/virtualroot?[/pathinfo]&rs:snapshot=snapshotid
where snapshotid is the time and date stamp of when the report was created.
But the book stops there and I can't imagine getting a time stamp back that
would match the millisecond the report was created.
Am I making sense?
--
Regards,
Gary Blakely
"Wei Lu" <weilu@.online.microsoft.com> wrote in message
news:P8QiON2kGHA.4864@.TK2MSFTNGXA01.phx.gbl...
> Hi Gary,
> Thank you for your posting!
> From your description, my understanding of this issue is: You want to view
> the Report History. If I misunderstood your concern, please feel free to
> let me know.
> You could access the report history via URL:
> For example:
> http://server/reportserver?/SampleReports/Company
> Sales&rs:Snapshot=2003-04-07T13:40:02
> Also, you could manage the reporting history in the Report Manager and SQL
> Management Studio (If you are using SQL Reporting Services 2005.)
> Here is the article for your reference:
> Managing Report History
> http://msdn2.microsoft.com/en-us/library/ms155849.aspx
> Hope this will be helpful!
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Gary,
Thank you for your update.
The information you get from the book is right. In my post, I provide the
method of Accessing the snapshot via URL, it's what exactly the book
refered.
My understanding of your request is, you want to use the URL in your
application and you want to get all the Snapshots which your report
related. If I misunderstood your concern, please feel free to let me know.
I assume you are using Reporting Services 2005.
Here is a sample query text to get the Snapshots and combine it to an URL
from the Report Server database:
USE ReportServer
GO
SELECT 'http://localhost/reportserver?'+C.Path +
'&rs:Snapshot='+CONVERT(nvarchar(50),H.SnapshotDate,126),
C.Name,H.SnapshotDataID,H.SnapshotDate FROM dbo.Catalog C inner join
dbo.History H
on C.ItemID = H.ReportID Where C.Name = '<YOUR REPORT Name>'
Hope this will be helpful!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Well, I'll play around with that but...
I know I can retrieve a history report if I know the EXACT timestamp. I'm
worried that the time between when I redirected to a url to produce the
report and the time when SSRS actually produced the report might be a couple
of milliseconds off and therefore my timestamp would not match that of the
report.
Gary
"Wei Lu" <weilu@.online.microsoft.com> wrote in message
news:1fPnoYDlGHA.4864@.TK2MSFTNGXA01.phx.gbl...
> Hi Gary,
> Thank you for your update.
> The information you get from the book is right. In my post, I provide the
> method of Accessing the snapshot via URL, it's what exactly the book
> refered.
> My understanding of your request is, you want to use the URL in your
> application and you want to get all the Snapshots which your report
> related. If I misunderstood your concern, please feel free to let me know.
> I assume you are using Reporting Services 2005.
> Here is a sample query text to get the Snapshots and combine it to an URL
> from the Report Server database:
> USE ReportServer
> GO
> SELECT 'http://localhost/reportserver?'+C.Path +
> '&rs:Snapshot='+CONVERT(nvarchar(50),H.SnapshotDate,126),
> C.Name,H.SnapshotDataID,H.SnapshotDate FROM dbo.Catalog C inner join
> dbo.History H
> on C.ItemID = H.ReportID Where C.Name = '<YOUR REPORT Name>'
> Hope this will be helpful!
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Gary,
Thank you for the update.
I would like to know how achieve the report. Once you create a report
snapshot, you could use the statement I provided in the previous post to
query it from the database.
Would you please post the method you use to achieve the report?
Thank you!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Wei,
I'm new to SSRS (always used Crystal before) and I have just managed to
produce it via url. So, I don't have a method yet where I archive the
report. (I have a new post that is going in that direction but I'm having
permissions problems there).
The docs and the wrox book I have are good for showing how to design reports
but, IMHO, they are lacking in management and rendering.
--
Regards,
Gary Blakely
"Wei Lu" <weilu@.online.microsoft.com> wrote in message
news:N9HrN1RlGHA.4528@.TK2MSFTNGXA01.phx.gbl...
> Hi Gary,
> Thank you for the update.
> I would like to know how achieve the report. Once you create a report
> snapshot, you could use the statement I provided in the previous post to
> query it from the database.
> Would you please post the method you use to achieve the report?
> Thank you!
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Gary,
I think the SQL Books Online is a great material for you to start SQL
Reporting Services.
To create the Report Snapshot, you need to do the following:
1. Access report manager via url:
http://servername/reports
2. Navigate to the report you want to achive.
3. In the History page, click New Snapshot button.
Here is the article for your reference.
Creating, Modifying, and Deleting Snapshots in Report History
http://msdn2.microsoft.com/en-us/library/ms156325.aspx
How to: Create and Delete History Snapshots (Management Studio)
http://msdn2.microsoft.com/en-us/library/ms156360.aspx
How to: Create, View, and Delete History Snapshots (Report Manager)
http://msdn2.microsoft.com/en-us/library/ms156310.aspx
Hope this information will be helpful for you!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Wei,
thanks again for all your help - please stay with me on this...
When I hit the new snapshot button for my report I get an error dialog that
says:
"Report history may not be created because the credentials used to run the
report are not stored, the report is using user-defined parameter values,
defalut report parameter values are mising, or if a linked report, the link
is no longer valid."
I think I may not be communicating clearly on this thread thus far...
I want a report added to history whenever I render it (with whatever
parameters I used at the time) then I need to get the "key" to the report so
I can re-render it, programatically, at any later time.
My problem is that when I render a report, programatically, I don't get back
any key. In other words I don't get back the snapshot ID. It's like adding
a record to a database and not getting the key back so you can never find
the record you added.
(in case this turns out to be impossible, I have another thread where I am
trying to render to a file and then I will create my own history system but
I'm having permission problems there.)
I'll play with that sql statment next.
Thanks,
Gary
"Wei Lu" <weilu@.online.microsoft.com> wrote in message
news:JshYoJdlGHA.2260@.TK2MSFTNGXA01.phx.gbl...
> Hi Gary,
> I think the SQL Books Online is a great material for you to start SQL
> Reporting Services.
> To create the Report Snapshot, you need to do the following:
> 1. Access report manager via url:
> http://servername/reports
> 2. Navigate to the report you want to achive.
> 3. In the History page, click New Snapshot button.
> Here is the article for your reference.
> Creating, Modifying, and Deleting Snapshots in Report History
> http://msdn2.microsoft.com/en-us/library/ms156325.aspx
>
> How to: Create and Delete History Snapshots (Management Studio)
> http://msdn2.microsoft.com/en-us/library/ms156360.aspx
> How to: Create, View, and Delete History Snapshots (Report Manager)
> http://msdn2.microsoft.com/en-us/library/ms156310.aspx
> Hope this information will be helpful for you!
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Gary,
Thank you for the response.
I would like to know how your render the report programatically. Render the
report does not save the report in the history. The report history only
stored the snapshot you created.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||I'm rendering it via response.redirect as follows:
string URLString ="http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fCMReports%Buyer&rs:Format=PDF&rs:Command=Render&campaignID=";
URLString += ddlCampaigns.SelectedValue;
URLString += "&campaignVersionID=";
URLString += ddlCamVersion.SelectedValue;
//URLString += "&TCR=T";
URLString += "&weekdate=";
URLString += weekDate;
URLString += "&buyerName=";
URLString += buyerName;
URLString += "&brIdentifier=";
URLString += brIdentifier;
URLString += "&nthWeek=";
URLString += nthWeek;
Response.Redirect(URLString);
The report prints just fine.
--
Regards,
Gary Blakely
"Wei Lu [MSFT]" <weilu@.online.microsoft.com> wrote in message
news:cet7yhplGHA.4164@.TK2MSFTNGXA01.phx.gbl...
> Hi Gary,
> Thank you for the response.
> I would like to know how your render the report programatically. Render
> the
> report does not save the report in the history. The report history only
> stored the snapshot you created.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Gary,
Thank you for your update.
As I mentioned in the previous post, when you render a report, reporting
services does not store the exection result in any place.
I think you need to achieve the PDF file by your self and you need to build
up a custom system to manage your report.
Also, I think you could consider the Reporting Services Web Services. The
Web Services provide a class libarary to get the information from the
Reporting Services.
Introducing the Report Server Web Service
http://msdn2.microsoft.com/en-us/library/ms154697(d=ide).aspx
Hope this will be helpful!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

Accessing Multiple databases from Stored procedure in SQL 2000

Hi ,

I have around 5 databases with same structure used to store data for different locations and services.

I have created an intermediate database which will have all the stored procedures to access data from above 5 databases.

My queries are common to all the databases. so,I would like to pass database name as an argument to my stored proc and execure query on specified database.

I tried this doing using "USE Databasename " Command. but it says ...We can not use "USE command " in stored proc or triggers. so ..what i did is ..

--

CREATE PROCEDURE TestDB_access(@.dbname varchar(100))
AS

BEGIN

DECLARE @.localDB varchar(100)

Set @.LocalDB=@.dbname

if @.LocalDB='XYZ'

EXEC ('USE XYZ ')
elseif @.LocalDB='ABC'

EXEC ('USE ABC')


Select * from Mytable

END

When I run this from my database , it gives me an error "unable to find table "mytable".

What is the best way to make my queries work with all the databases.

Thanks in advance

Venu Yankarla

Not sure what you are exactly trying to do but you can qualify a table with a database name and use it that way, however there is a limit in an SP of referring to 8 databases.

Try something like select * from Pubs..Authors where Pubs is the db name

|||

Thank you for your reply.

I can use the query "select * from Pubs..Authors where Pubs is the db name " if i know from which database i need to get the data.

In my case ... I want this dbname as a parameter to stored procedure. I can pass this to stored proc as parameter and bulid a string for SQL query and execute it. But I feel this as time consuming process as my queries will have atleast 5 joins in one query.

So , what I am looking for is .... Can we execute a query related to tables from a database (ABC or DEF or ETC) by using a stored proc in a database (XYZ)

Common thing in my case ..all databases has the same table structures but different data related to different locations.

in Query analyzer , we can execute queries on database (ABC or DEF) by staying in database (XYZ) using statement USE ABC and then execute SQL query.

USE ABC will change the database context and execute the query on "ABC" db tables.

Hope ..I am clear now..

Thanks

Venu yankarla

|||I think you will have to use sp_executesql for this