Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Wednesday, March 28, 2012

One data source view and multiple data source

Hi,

In my datawarehouse we have different database one for dimensions and one for fact tables.

can we create a cube to pull dimensions from one data soure and fact from other databsource?

I recommend you to have the fact tables and the dimensions in the same database.

Your long term quick-fix is to use views between the databases.

Your short scenario description looks like you are building a cube directly from a source system.

If you need to connect another source system you will have to create a data wareouse to consolidate each source.

If not, you wille be creating information silos above each source system that you cannot connect to a second system.

HTH

Thomas Ivarsson

|||both the source are on the same SQL Server but different databases, I was planning to use View but was just considering the performance impact that will cause.|||

Actually Analysis Services allows for having dimensions and parittions to come from different datasources.

The caveat here is not to use different datasources to define your dimension. In such case Analysis Services might decide to use OPENROWSET clause as part of the query it sends during processing of dimension. This would slow you down considerably. But having partitions to come from different datasource should be perfectly fine.

Run Profier to capture SQL queries Aanlysis Server sends during processing and verify you dont get OPENROWSET is these queries.

Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Friday, March 23, 2012

On delete trigger for a view

Hi!
I have a view defined in MANAGE database as:
CREATE VIEW dbo.sysdatabasesview AS
SELECT *
FROM master.dbo.sysdatabases WITH (nolock)
GO
Trying to place a trigger on it:
CREATE TRIGGER sysdatabasesview$onDelete ON [dbo].[sysdatabasesview]
FOR DELETE
AS
Declare @.user_name sysname, @.msg varchar(3000)
select @.user_name = name
from deleted
set @.msg = 'Delete database ' + @.user_name + ' on server ' +
@.@.servername + ' from host ' + host_name()
insert into MANAGE..MAIL (recipient, subject, message, occur)
values ('myemail@.domain.local', 'Delete datadase', @.msg, getdate())
Get an error:
Error 208: Invalid object name 'dbo.sysdatabasesview'
What is wrong?
Thanks.This is a multi-part message in MIME format.
--=_NextPart_000_0012_01C3872D.EA0155E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You cannot create a FOR trigger (now known as an AFTER trigger) on a =view. You can create an INSTEAD OF trigger on a view, however.
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Roust_m" <roustam@.hotbox.ru> wrote in message =news:a388fd78.0309300241.4462ca59@.posting.google.com...
Hi!
I have a view defined in MANAGE database as:
CREATE VIEW dbo.sysdatabasesview AS
SELECT *
FROM master.dbo.sysdatabases WITH (nolock)
GO
Trying to place a trigger on it:
CREATE TRIGGER sysdatabasesview$onDelete ON [dbo].[sysdatabasesview] FOR DELETE AS Declare @.user_name sysname, @.msg varchar(3000) select @.user_name =3D name from deleted
set @.msg =3D 'Delete database ' + @.user_name + ' on server ' +
@.@.servername + ' from host ' + host_name()
insert into MANAGE..MAIL (recipient, subject, message, occur) values ('myemail@.domain.local', 'Delete datadase', @.msg, getdate())
Get an error:
Error 208: Invalid object name 'dbo.sysdatabasesview'
What is wrong?
Thanks.
--=_NextPart_000_0012_01C3872D.EA0155E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

You cannot create a FOR trigger (now =known as an AFTER trigger) on a view. You can create an INSTEAD OF trigger on =a view, however.
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"Roust_m" wrote in message news:a388fd=78.0309300241.4462ca59@.posting.google.com...Hi!I have a view defined in MANAGE database as:CREATE VIEW dbo.sysdatabasesview ASSELECT *FROM master.dbo.sysdatabases WITH (nolock)GOTrying to place a =trigger on it:CREATE TRIGGER sysdatabasesview$onDelete ON [dbo].[sysdatabasesview] FOR DELETE AS Declare @.user_name =sysname, @.msg varchar(3000) select @.user_name =3D name from deleted =set @.msg =3D 'Delete database ' + @.user_name + ' on server ' =+@.@.servername + ' from host ' + host_name()insert into MANAGE..MAIL (recipient, =subject, message, occur) values ('myemail@.domain.local', ='Delete datadase', @.msg, getdate()) Get an error:Error =208: Invalid object name 'dbo.sysdatabasesview'What is wrong?Thanks.

--=_NextPart_000_0012_01C3872D.EA0155E0--sql

Wednesday, March 21, 2012

OLEDB source - Use table or select only columns needed.

Hi All,

With the OLEDB source, is it wrong to use a table / view as a source and only check the columns required or is it beneficial to write a select col1, col2 etc etc as a SQL command?

I cannot see any difference in performance between the two.

Thanks.

Always always always use a SQL command so as to avoid the situation documented here: http://blogs.conchango.com/jamiethomson/archive/2006/02/21/2930.aspx I can't stress this enough.

Also check #4 here: http://blogs.conchango.com/jamiethomson/archive/2006/01/05/2554.aspx Basically, only pull in the data that you need otherwise performance will suffer.

-Jamie

|||Thanks Jamie but...

I would still like to know the underlying reason it is bad :)

Accepted that Select * is bad due to many reasons but:
My "tables" are views which themselves only select columns required for the data flow and nothing more.

Basically I am being lazy - I write the columns out in the view and don't _really_ want to write them again in SSIS :)

From a performance point of view, the above method is exactly the same either way. I cannot and have not seen what you described.

Will play around some more and try find a reason (unless someone wants to save us the trouble....)|||

Well if nothing else I would do it in the interests of best practice. And also cos I'm picky - I hate seeing a selected table rather than a SQL statement :)

-Jamie

|||

Jamie Thomson wrote:

Well if nothing else I would do it in the interests of best practice. And also cos I'm picky - I hate seeing a selected table rather than a SQL statement :)

-Jamie

A counter to that is I hate seeing any form of SQL in SSIS. Rather have the logic in a view / proc or just pull from the table. Make life easier when looking for bugs.
(yes, you could make a rule such as "do not use anything more that Select *" :)|||

Let's agree to disagree! :)

-J

OLEDB Provider Errors

I have an asp page that is using OLEDB to connect to SQL
Server 2K (We'll call it 2k1). It requests data from a
view on 2k1 which via linked server points to a an
instance of SQL Server 7.0 on a different box (We'll call
it 702). In running this command we receive very
sporadic errors. There are two in particular. Both are
regarding the transactions being used for the open
connection. Every thing I read points to using explicit
transactions which we are not. The error will last for
about 20 minutes and just disappear. The developers
stating that they are definately closing connections. I
don't know how to proceed.
Here are the errors.
1.
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'SQLOLEDB' reported an error.
[OLE/DB provider returned message: Connection is busy
with results for another command]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
IOpenRowset::OpenRowset returned 0x80004005: ].
2.
Server: Msg 7392, Level 16, State 2,
Could not start a transaction for OLEDB
provider 'SQLOLEDB'. [OLE/DB provider returned message:
Only one transaction cant be active on this session.Are you using Transaction Object
try use the connection's tranaction objectsql

Friday, March 9, 2012

OLE DB Source using table name variable

I have a package-level variable [User::viewName], type = string, containing a view name. I want to setup an OLE DB source to use this variable value as the source, so Data access mode = "Table name or view name variable". The Variable name dropdown contains [User:viewName], so I select it. When I click OK to leave the edit dialog I get the error:

The variable User::viewName is required to be of type "VT_BSTR".

Only variables of type String occur in the Variable name dropdown; if I try changing it to a type other than string it doesn't occur in the dropdown. What is VT_BSTR and how can I change the variable type to it?

I've never seen VT_BSTR in my life, that isn't a data type that I know of. Something is awry here - I wonder if it could be package corruption. Does the same happen when you try a differrent string variable?

-Jamie

|||I'm copying and pasting a package in Solution Explorer, then playing with the copy to see what works, then going back to the original. The package this problem is occurring in is a copy; might that be the problem? This seems like such an ordinary thing to do (get the table or view name from a variable) that I'm really surprised it's happening. Are there known problems with copying packages?|||

I don't know of any - but it does sound as though some corruption has occurred somewhere. Can you share the contents of the .dtsx file? (i.e. open it in notepad and copy the contents to here)?

-Jamie

|||

mruniqueid wrote:

I'm copying and pasting a package in Solution Explorer, then playing with the copy to see what works, then going back to the original. The package this problem is occurring in is a copy; might that be the problem? This seems like such an ordinary thing to do (get the table or view name from a variable) that I'm really surprised it's happening. Are there known problems with copying packages?

Can't think it matters, but be sure you generate a new GUID on the copied package. Control-flow background: right click, properties. Select the drop down in the ID field and generate a new GUID.|||

In my original package Data Flow I had an OLE DB Source with Data access mode = "Table or view". When I try to set Data access mode = "Table name or view name variable" in the original package I run into this trouble.

I tried creating a new package from scratch and realized I've got a knowledge gap. If you create an OLE DB Source and set Data access mode = "Table name or view name variable" right from the start, then how do you define the source output columns since there's no table to derive them from? I have several views with the same structure; in my original package I picked one of these as "Name of the table or the view" which of course defined output columns for the source, then tried to change Data access mode to a variable as described above.

Can I start with Data access mode = variable? If I try that I get the error "A destination table name has not been provided". I created an OLE DB Destination and connected it to the OLE DB Source but the error persists. What is the proper sequence of steps and settings to use a variable name for Data Access Mode in an OLE DB Source?

|||

mruniqueid wrote:

In my original package Data Flow I had an OLE DB Source with Data access mode = "Table or view". When I try to set Data access mode = "Table name or view name variable" in the original package I run into this trouble.

I tried creating a new package from scratch and realized I've got a knowledge gap. If you create an OLE DB Source and set Data access mode = "Table name or view name variable" right from the start, then how do you define the source output columns since there's no table to derive them from?

The name of the table needs to be stored in the variable.

mruniqueid wrote:

I have several views with the same structure; in my original package I picked one of these as "Name of the table or the view" which of course defined output columns for the source, then tried to change Data access mode to a variable as described above.

Can I start with Data access mode = variable? If I try that I get the error "A destination table name has not been provided". I created an OLE DB Destination and connected it to the OLE DB Source but the error persists. What is the proper sequence of steps and settings to use a variable name for Data Access Mode in an OLE DB Source?

1. Create the variable of type string

2. Add the table name into teh variable

3. Create your OLE DB Source and select the variable that you have just chosen.

-Jamie

|||

I didn't realize the variable value was evaluated at design time, since it's set at runtime. Makes sense though - thanks a lot!

- Dana

Wednesday, March 7, 2012

OLE DB Destination Table/View Drop Down

Is there any way around (or will there be) using the drop-down? It takes several minutes when running against an Oracle Apps database to populate that dropdown with the several hundreds of tables and views.

TIA.

Yes, just write a SQL statement instead. You should be doing this anyway to be honest, selecting from the dropdown is very bad practice.

-Jamie

|||

For an OLE DB Destination? I always write SQL for the sources, but don't quite follow how to do that for a destination.

Thanks for the quick reply!

-Chad

|||

DAMN. You said Destination. Sorry, I should read posts more clearly.

However, you can still do this. Just select 'SQL Command' as your Data Access Mode and your SQL statement just selects all the columns that you want to insert into from the table that you want to insert into.

Ignore what I said about best practice though. its best practice for sources, not destinations.

-Jamie

Monday, February 20, 2012

Old SQL ODBC driver on 2003 Server

Anyone run into this.
I have a Windows 2003 Server which has a very old sql Server ODBC Driver
installed. If I go into Data Sources and view the SQL Server driver it is
dated back in 1997. Very old and I suspect that when someone installed 6.5
SQL Server tools, it overwrote the newer driver.
Bottom line, how do I re-install SQL Server Driver, or other ODBC drivers
for that matter on a 2003 server without reinstalling the OS?
Eric Correa
Windows Server Engineer
Try installing the latest MDAC (version 2.8, I think). You can get that from the Microsoft site.
"Eric Correa" <EricCorrea@.discussions.microsoft.com> wrote in message
news:7ADBEB08-8E19-4B1A-B25D-95CFEA94C915@.microsoft.com...
> Anyone run into this.
> I have a Windows 2003 Server which has a very old sql Server ODBC Driver
> installed. If I go into Data Sources and view the SQL Server driver it is
> dated back in 1997. Very old and I suspect that when someone installed 6.5
> SQL Server tools, it overwrote the newer driver.
> Bottom line, how do I re-install SQL Server Driver, or other ODBC drivers
> for that matter on a 2003 server without reinstalling the OS?
> --
> Eric Correa
> Windows Server Engineer
|||You cannot install MDAC 2.8 on a Windows 2003 Server. Not allowed.
Eric Correa
Windows Server Engineer
"Scot T Brennecke" wrote:

> Try installing the latest MDAC (version 2.8, I think). You can get that from the Microsoft site.
> "Eric Correa" <EricCorrea@.discussions.microsoft.com> wrote in message
> news:7ADBEB08-8E19-4B1A-B25D-95CFEA94C915@.microsoft.com...
>
>
|||You will need to run an "update install" of Windows 2003 (or you could
re-install Windows 2003 SP1).
An "update install" is you just pop in the Windows 2003 CD and say you are
going to install it. The setup will prompt you if you want to do an "update
install" say yes. This is sort of like a repair install so to speak.
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Eric Correa" <EricCorrea@.discussions.microsoft.com> wrote in message
news:745D9A13-B613-41A0-A949-63D9B712597F@.microsoft.com...[vbcol=seagreen]
> You cannot install MDAC 2.8 on a Windows 2003 Server. Not allowed.
> --
> Eric Correa
> Windows Server Engineer
>
> "Scot T Brennecke" wrote:

Old SQL ODBC driver on 2003 Server

Anyone run into this.
I have a Windows 2003 Server which has a very old sql Server ODBC Driver
installed. If I go into Data Sources and view the SQL Server driver it is
dated back in 1997. Very old and I suspect that when someone installed 6.5
SQL Server tools, it overwrote the newer driver.
Bottom line, how do I re-install SQL Server Driver, or other ODBC drivers
for that matter on a 2003 server without reinstalling the OS?
Eric Correa
Windows Server EngineerTry installing the latest MDAC (version 2.8, I think). You can get that fro
m the Microsoft site.
"Eric Correa" <EricCorrea@.discussions.microsoft.com> wrote in message
news:7ADBEB08-8E19-4B1A-B25D-95CFEA94C915@.microsoft.com...
> Anyone run into this.
> I have a Windows 2003 Server which has a very old sql Server ODBC Driver
> installed. If I go into Data Sources and view the SQL Server driver it is
> dated back in 1997. Very old and I suspect that when someone installed 6.5
> SQL Server tools, it overwrote the newer driver.
> Bottom line, how do I re-install SQL Server Driver, or other ODBC drivers
> for that matter on a 2003 server without reinstalling the OS?
> --
> Eric Correa
> Windows Server Engineer|||You cannot install MDAC 2.8 on a Windows 2003 Server. Not allowed.
--
Eric Correa
Windows Server Engineer
"Scot T Brennecke" wrote:

> Try installing the latest MDAC (version 2.8, I think). You can get that f
rom the Microsoft site.
> "Eric Correa" <EricCorrea@.discussions.microsoft.com> wrote in message
> news:7ADBEB08-8E19-4B1A-B25D-95CFEA94C915@.microsoft.com...
>
>|||You will need to run an "update install" of Windows 2003 (or you could
re-install Windows 2003 SP1).
An "update install" is you just pop in the Windows 2003 CD and say you are
going to install it. The setup will prompt you if you want to do an "update
install" say yes. This is sort of like a repair install so to speak.
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Eric Correa" <EricCorrea@.discussions.microsoft.com> wrote in message
news:745D9A13-B613-41A0-A949-63D9B712597F@.microsoft.com...[vbcol=seagreen]
> You cannot install MDAC 2.8 on a Windows 2003 Server. Not allowed.
> --
> Eric Correa
> Windows Server Engineer
>
> "Scot T Brennecke" wrote:
>