How To Implement SCD Type1 And Type2 At The Same Table
Apr 7, 2008
Hi All,
I want to implement SCD Type1 and Type2 in one table, i.e. my columns has got type1 and type2. I have the following table made from different tables; the columns are Column1, Column 2, Column3, Column4, Column5, and Column6. Here I have two type1 (Column2 and Column3 ) I want these to be Typ1, the rest will be Type2. My concern is I don€™t want use SCD component of the SSIS (b/se of performance issue, I hope) but I am using Lookup and conditional Split instead. The General concept is i have type1 and type2 dimensions in one table (dimension table). The question is:
1. Can I meet my goal using these components I mean without SCD transformation component and again i am thinking to avoid OLE DB Command transformation Component?
2. If yes then how do I use the conditional split, I mean how to write the condition for type1 and type2.
3. Is there any other option to use instead of SCD transformation component having type1 and type2 at the same table?
Thank you in advance for everything, I hope to get one solution from all of you guys. Have a great day.
Thank you,
it is taken from SQL2K5 SP2 readme.txt. Anyone have idea what to do to implement this ? Our sp2 is failing. we suspect the above problem and researching it.we are running on default instance of SQL2K5 on win2003 ent sp2
"When you apply SP2, Setup upgrades system databases. If you have implemented restrictions on the ALTER DATABASE syntax, this upgrade may fail. Restrictions to ALTER DATABASE may include the following:
Explicitly denying the ALTER DATABASE statement.
A data definition language (DDL) trigger on ALTER DATABASE that rolls back the transaction containing the ALTER DATABASE statement.
If you have restrictions on ALTER DATABASE, and Setup fails to upgrade system databases to SP2, you must disable these restrictions and then re-run Setup."
I am using Visual Studio 2005 & SQL Server. How do i implement a DDL for users to select which value to input. like i can with Access. i do not need a table i think. if not the table would have only ID & Value.?
We are developing the web application using ASP.NET 2.0 using C# with Backend of SQL Server 2005.
Now we have one requirement with my client, Already our application live in ASP using MS Access Database. In Access Database our client already wrote the query, those query call the another query from same database. So I want to over take this functionality in SQL Server 2005.
In ASP Application, We call this query €œ081Stats€? from Record set.
This €˜081Stats€™ query call below sub query itself
Master Query: 081Stats
SELECT DISTINCTROW [08Applicants].school, [08Applicants].Applicants, [08Interviewed].Interviewed, [Interviewed]/[Applicants] AS [interviewed%], [08Accepted].Accepted, [Accepted]/[Applicants] AS [Accepted%], [08Dinged].Dinged, [Dinged]/[Applicants] AS [Dinged%], [08Waitlisted].Waitlisted, [Applicants]-[Accepted]-[Dinged] AS Alive, [08Matriculating].Matriculating, [Matriculating]/[Accepted] AS [Yield%] FROM ((((08Applicants LEFT JOIN 08Interviewed ON [08Applicants].school = [08Interviewed].school) LEFT JOIN 08Accepted ON [08Applicants].school = [08Accepted].school) LEFT JOIN 08Dinged ON [08Applicants].school = [08Dinged].school) LEFT JOIN 08Waitlisted ON [08Applicants].school = [08Waitlisted].school) LEFT JOIN 08Matriculating ON [08Applicants].school = [08Matriculating].school;
Sub Query 1: 08Accepted
SELECT statusTbl.school, Count(1) AS Accepted FROM statusTbl WHERE (((statusTbl.decision)=1) AND ((statusTbl.yearapp)="2008")) GROUP BY statusTbl.school ORDER BY Count(1) DESC;
Sub Query 2: 08Applicants
SELECT statusTbl.school, Count(1) AS Accepted FROM statusTbl WHERE (((statusTbl.decision)=1) AND ((statusTbl.yearapp)="2008")) GROUP BY statusTbl.school ORDER BY Count(1) DESC;
Sub Query 3: 08Dinged
SELECT statusTbl.school, Count(1) AS Dinged FROM statusTbl WHERE (((statusTbl.decision)=0) AND ((statusTbl.yearapp)="2008")) GROUP BY statusTbl.school ORDER BY Count(1) DESC;
Sub Query 4: 08Interviewed
SELECT statusTbl.school, Count(1) AS Interviewed FROM statusTbl WHERE (((statusTbl.interview)=True) AND ((statusTbl.yearapp)="2008")) GROUP BY statusTbl.school ORDER BY Count(1) DESC;
Sub Query 5: 08Matriculating
SELECT statusTbl.school, Count(1) AS Matriculating FROM statusTbl WHERE (((statusTbl.userdec)=True) AND ((statusTbl.yearapp)="2008")) GROUP BY statusTbl.school ORDER BY Count(1) DESC;
So now I got the solution from SQL Server 2005. I.e. Common Table Expressions, So I got the syntax and other functionality, Now my doubts is how do implement the CTE in SQL Server 2005, where can I store the CTE in SQL Server 2005.
How can I call that CTE from ASP.NET 2.0 using C#?
CTE is replacing the Stored Procedure and Views, because it is memory based object in SQL Server 2005.
How can I implement the CTE, where can I write the CTE and where can I store the CTE.
And how can I call the CTE from ASP.NET 2.0 using C#.
I would like to know what is the use of business key? Is it necessary to have unique key between source and destination? If no, How can we implement SCD?
PS : My source is CSV files and Destination is Oracle DB?
What is the way we could implement a business logic from a Table bystoring it statemnnets in a colums and defining an execute sql toexecute it.Some legal requirements make it diffcult for us to createmodify stored procdures so Iwant to have a process where we create newrows in a table and execute it to execute business logic.All views are welcome.Havin g one table two tables different approaches to store ststementsand execute them....Case logic how to implement it?Flags in the tble colums in the tablesetcThanksAjay Garg
Hi all, I had many groups of data which column A store number & column B store location. My syntax as below :- select count(columnA) as no, columnB from table group by columnB No columnB 20 A 10 B 5 C How can I select 5 rows for Each ColumnB? (total 15 rows of record) Thanks!
hi friends....... I have one doubt. how can we use cursor in sql. in oracle they implement cursors on stored procedure, can we implement same concept in sql stored procedure...regards Samuel chandradoss . J
I have place an question, but in some other place in the same forum.
My apologies for that
I wanted to implement mirroring I hereby let u know the steps
1. Created a database in Principal server named Mirror1 and one table named tblMirror1.( no values inside the table)
2. Repeated the same in Mirror in Witness
3. Selected the Principal server's database -->right click-->tasks-->mirror
4. from the left hand panel selected Options -->recovery model-->full
5. selected Mirroring from left hand panel-->configure secuirty-->entered mirror and witness name--Success
6. When I click on start mirroring I have an error stating
" Alter failed for database mirror1"
"Database mirroring cannot be enabled because Mirror1 database may have bulk logged changes that have not been backed up etc...."
7. followed this one BACKUP database mirror1 TO DISK='C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupmirror1_FULL.BAK'
got the answer as
Processed 160 pages for database 'mirror1', file 'Mirror1' on file 2. Processed 1 pages for database 'mirror1', file 'Mirror1_log' on file 2. BACKUP DATABASE successfully processed 161 pages in 0.318 seconds (4.147 MB/sec).
According to sources Run a restore of this backup on your mirror. This can be done through the GUI or using a T-SQL command.
The database restore must use the NO RECOVERY option, so the database stays in a loading state.
Also the database name on the mirror must be the exact same name as the principal
RESTORE TestMirror FROM DISK='C:Backup TestMirror_FULL.BAK' WITH NORECOVERY
Hence did the below
RESTORE database mirror1 FROM DISK='C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupmirror1_FULL.BAK' WITH NORECOVERY
ERROR
Msg 3201, Level 16, State 2, Line 1 Cannot open backup device 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupmirror1_FULL.BAK'. Operating system error 2(The system cannot find the file specified.). Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally.
HENCE MODIFIED AS
use master go RESTORE database mirror1 FROM DISK='C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupmirror1_FULL.BAK' WITH NORECOVERY
Msg 3201, Level 16, State 2, Line 1 Cannot open backup device 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupmirror1_FULL.BAK'. Operating system error 2(The system cannot find the file specified.). Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally.
I've been using a piece of transact code to generate random strings of characters in a lot of scripts and I wanted to wrap it up all nice and neat into a function. I came up with the script below.
However, this fails with the following error.. quote:Invalid use of 'rand' within a function. I've allready tried using dynamic sql and sp_executesql inside the function hoping that a new scope would let me use rand() but that isn't allowed either.
I'm Using sql server 2000. Any ideas?
Charlie.
-- snip ----
CREATE FUNCTION dbo.randstr ( @lengthINT) RETURNS VARCHAR
AS BEGIN DECLARE @outputVARCHAR(8000) DECLARE @allowedVARCHAR(8000)
SET @allowed = '234679abcdefghjkmnpqrstuvwxyz234679ACDEFGHIJKLMNPQRTUVWXYZ'
SET NOCOUNT ON DECLARE @charmapTABLE (charpos INT IDENTITY (1,1), symbol CHAR) DECLARE @counterINT DECLARE @characterINT DECLARE @maplengthINT
SET @maplength = LEN(@allowed) SET @character = 0 SET @output = ''
-- Insert the allowed characters into the character map table SET @counter = 1 WHILE (@counter < @maplength + 1) BEGIN INSERT INTO @charmap SELECT SUBSTRING(@allowed,@counter,1) SET @counter = @counter + 1 END
-- Start the loop to generate @output SET @counter = 1 WHILE (@counter < @length + 1) BEGIN
-- RAND() should output a floating point number between 0 and 1 however... -- Sometimes the rand() function spits out a number greater than 1 -- or the multiplication results in 0 WHILE (@character < 1) OR (@character > @maplength) BEGIN SET @character = CAST(@maplength * RAND()+1 AS INT) END
-- Add the random character to @output SET @output = @output + (SELECT symbol FROM @charmap WHERE charpos = @character)
-- Increment and Reset the @character variable SET @counter = @counter + 1 SET @character = 0 END
i hav a text file in this format.. currency,exchangerate(INR),date dollar,45,20/04/2006 dollar,46,22/04/2006 britishpound,65,20/04/06 dirham,12,20/04/06..etc..
now,i want that using this as source.. 2 tables should be created and filled with appropriate data.. CurrencyMaster..Currencyid(PK),Currencyname CurrencyDailyRate..ID,Currencyid(FK),rate,date
I have the following transact SQL code which I want to change to a set of SSIS components.
SELECT blah, blah
FROM PSTAGE..[stage_OFFER_PRICE_DIVIDEND] AS SOPD LEFT OUTER JOIN PSTAGE..[stage_PRICE_GRP] AS SPG ON SOPD.PRICE_GRP_ID = SPG.PRICE_GRP_ID LEFT OUTER JOIN PSTAGE..[stage_type] AS TYP ON TYP.TYPE_CD=SPG.PRICE_TYPE_TYPE4_CD and TYP.TYPE_CL_CD = '0017'
I know I can join two data sets using a merge join (left join) but how do I combine a third merge join? Should I be doing this or should I just stick my code in a SQL Task instead?
My report is taking long time to display hundered of records.So we want to display 15 records per page and Next page link at the end of report.Please help me how to do this.
I have a table search the record. The user can search by name, id, status, address and other information.I want to make the search function more robust. For example, when the database has a record with name = "Michael Jackson", either typing any subset of the name will show this record.I would like to know if there is any easy way to implement this with VS2005 and SQL2005 Express.Thank you
if (!ProcessNonQuery(oCommand, sMethodName)) goto Failed;
Failed:
if (ErrorCode > 0) bReturn = false;
oConn.Close(); } } return bReturn;
p_gID, p_gAuthorityID is of type guid. sNewRole is of type string. I get the error " Object must implement IConvertible at oCommand.ExecuteNonQuery(); whihch is in the function if (!ProcessNonQuery(oCommand, sMethodName))
Now, the root level items will have a ParentID of NULL, and the child nodes will have it's parent's ID in it's ParentID column (a simple self-referencing relationship).
However, when I select it, I would like to Order by ID, but then have all it's children right after it. For example, if this is the unsorted view:
Code:
ID ParentID Name ---------------------- 1 <NULL> Test 2 1 Test Child 1 3 <NULL> Test 2 4 1 Test Child 2 5 3 Test 2 Child 1
I would like the sorted to look like:
Code:
ID ParentID Name ---------------------- 1 <NULL> Test 2 1 Test Child 1 4 1 Test Child 2 3 <NULL> Test 2 5 3 Test 2 Child 1
Is this possible with my current structure? If not, how could I change it?
Iam Executing the sp logic.suppose incase if any problem occurs inbetween execution(NO SPACE,communication failure,log full) data is getting commited partially insteady of rollbacking entire transaction.
CREATE procedure RBI_Control_sp as begin
set nocount on --Checking the count before truncating exec fin_ods..count_sp
--Truncating the Table exec fin_ods..trun_sp
--Data Transfer exec fin_ods..RBI_Data_Transfer_sp
--Checking the count after Data transfer exec fin_ods..count_sp
--temp table Table population,Fetching data from the fin_ods[erp Table] exec FIN_wh..RBI_SPExecution_sp
Hi all, I was hoping I could get some ideas about how to implement a share portfolio. Right now I've got a transaction table that lists the name of the share, quantity, amount and a few other details of every transaction I make. I think I'll be better off breaking it up into two tables; sales and purchases.
I want to create a portfolio using this data. I figured that I could set a query to show one column with names of all the shares (selected from the share purchase table) and another column to work out the current number of shares I hold. Thing is, I can't seem to work out a formula that will pick up all purchases of a certain share, then subtract of sales of the same and then place it in the column for that share in the portfolio.
There's probably a much cleaner way to do it that I'm completely missing. Any ideas? Perhaps edit the input form for the transaction table(s) so that it notes the name of the share and creates a new record if the share isn't already in the portfolio or adjusts it if it is.
Using: VB.Net 2003, SQL Server 2000 and nText Column...
Examples: "Writing BLOB Values to a Database [Visual Basic]" and "Conserving Resources When Writing BLOB Values to SQL Server [Visual Basic]"
I modified the following code from the samples that were available in Help and MSDN. When my application reaches the ExecuteNonQuery statement it informs me that the Byte Array oDocument must implement IConvertible. I have even tried the extended version which uses a SQL Insert followed by UPDATETEXT with Pointers, and I get the same result with the Byte Array used in that example. My goal is to have Users Append certain documents to Proposals within my database, as I understand that is what I would be doing anyway if I used SharePoint.
Following the examples I have not trouble whatsoever reading an Image File from SQL Server 2000, and therefore I expect no trouble with nText Fields. I just cannot seem to insert Documents or Images via VB Code.
What is wrong with the examples that I cannot use the same code?
---- VB Code Follows ----
Private Sub btnSelectFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectFile.Click
Dim oSQLConnection As System.Data.SqlClient.SqlConnection
Dim oSQLCommand As System.Data.SqlClient.SqlCommand
Dim oSQLDataReader As System.Data.SqlClient.SqlDataReader
Dim oDocument() As Byte
Try
'Define the Initial Directory to be the "My Documents" Directory.
ofdAttachment.InitialDirectory = "My Documents"
'Filter for File of Word, PDF, and Text. This will suffice for now.
Is there any way to do things with filesystem in SQL 2005 ? I want to check a file and if exists I could replace data into it or create the file if not exists. I tried build a DLL file using C# to do those things and registered it in SQL 2005 but when I execute the procedure it returns an error like this below :
Msg 6522, Level 16, State 1, Procedure testfsq, Line 0A .NET Framework error occurred during execution of user-defined routine or aggregate "testfsq": System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.System.Security.SecurityException: at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.IO.FileInfo..ctor(String fileName) at FSQuery.fsq()
So, is that means that we can't use another namespace in .NET framework but Microsoft.SQLServer.Server ? thanks in advance.
I am totally new to MS SQL and need some help. Finding the so called "help" not very helpful, surprisingly Google not turning up much either, maybe not doing using the right search criteria?
I am using MS SQL Server Express 2005.
What I want to do is when a user adds a grower to the GrowerList (via an ASP.NET page) it is done so that the GrowerID increments automatically to the next unique number (currently set GrowerID as primary key, type int).
I'm currently learning how to implement Encryption into my SQL database, and I've run into something I don't know how to explain or understand. I'm working on creating a set encryption for a set of columns in a database, and I don't know how to figure out what size the VARBINARY column needs to be. After some trial and error, I've noticed that a clear text of 9 characters needs 68 varbinary characters, 100 cleartext=148 varbinary, and 254 cleartext= 308 varbinary characters. How is the minimum number of varbinary characters calculated?Â
We are planning for a DW solution based upon SQL Server 2005 EE. We will use a 64 bit machine for the Database engine and Analysis Services. Should we have seperate server for SSIS or should we use the same 64 bit box? If we go for a sepaerate server for SSIS should we use 32 bit or 64 bit ?
The primary datasources will be a new developed .NET application and a financial system based upon SQL Server 2000.
Every good advice/experiance is greatly appriciated!
I have a table containing a list of source table names to be transferred to destination.I need to pass each and every table name as a variable and based on the name of the variable I need to select data from source and insert into destination.The source and destinations are on 2 different servers.The source tables have different metadata (different column names and data types).Any help how to implement this would be greatly appreciated.
To be more clear I have List table which has below format
TABLE NAME CUSTOMER PRODUCT INVENTORY
Customer , product, inventory are tables names. So my package should first go and collect the table name from LIST table and then transfer the Customer table data from Server A to Server B. This should be repeat untill all the tables listed in LIST table are transferred.
i try to do a simple insert using SQLDataSource and a Stored Procedure I try all night and always have this error
Object Must Implement IConvertible
I can’t understand where I wrong..
Looking around I understand is maybe a typecasting problema but I not find nothing more understeable.. Could someone tell me why Microsoft release this SQLdatasorce making more difficult a simple insert? If someone could help me to fix this problem please
Here is the code ------------------------------------------------------------------------------------------------------------
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try SqlDataSource1.Insert()
Catch ex As Exception Response.Write(ex.ToString) Finally SqlDataSource1.Dispose()
End Try
End Sub ------------------------------------------------------------------------------------------------------------
Hi, I am a beginner in ASP.NET 2.0 I am creating a simple blog website. I am using a DataReader object to collect all of the entries in the database (in one full sweep) and then display them by adding rows to a table and populating them. I would like to enable paging so that only 5 blog entries at a time are displayed. The user should be able to page backwards and forwards 5 at a time. Please can somebody give me some ideas of how I should do this? Should I read all of the data into some kind of list so that all of the data is then readily available? An arraylist or something? I realise that the DataReader object reads in one continuous stream so I couldn't expect it to read backwards and forwards from the database. I include a portion of my code below which reads the database. Many thanks. Dim objCommand As New SqlCommand objCommand.Connection = objConnection objConnection.Open() objCommand.CommandText = "SELECT BlogID, Date, Blog FROM BlogSite2_Blogs ORDER BY Date DESC" Dim objReader As SqlDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection) Dim dateDateTime As Date Dim strBlogEntry As String Dim intBlogID As Integer Do While objReader.Read() intBlogID = objReader.GetValue(0) dateDateTime = objReader.GetDateTime(1) strBlogEntry = objReader.GetString(2) CreateBlogRow(intBlogID, dateDateTime, strBlogEntry) Loop objReader.Close()
Hello, I do not know how to implement transaction roll back in asp.net application. I am using SqlHelper class to communicate with my sql db.Thanks, junior