15 June 2011

View in Sql Server 2008

View in Sql Server 2008

Creates a virtual table whose contents (columns and rows) are defined by a query. Use this statement to create a view of the data in one or more tables in the database.
For example, a view can be used for the following purposes:

-To focus, simplify, and customize the perception each user has of the database.

-As a security mechanism by allowing users to access data through the view, without granting the users permissions to directly access the underlying base tables.

-To provide a backward compatible interface to emulate a table whose schema has changed.

Example
--Partitioned view as defined on Server1
CREATE VIEW Customers
AS
--Select from local member table.
SELECT *
FROM CompanyData.dbo.Customers_33
UNION ALL
--Select from member table on Server2.
SELECT *
FROM Server2.CompanyData.dbo.Customers_66
UNION ALL
--Select from mmeber table on Server3.
SELECT *
FROM Server3.CompanyData.dbo.Customers_99

16 comments:

  1. Thanks. Dada, have you used silverlight with .NET? What is silverlight and how I can use it with .NET?

    Tell me from yourself, I mean not from LINKs.

    Dada, do you know Bangla language?

    ReplyDelete
  2. I am Arun Prakash,I am working in software company in coimbatore now.sorry i don't know Bangla language.I didn't used silver light yet...

    ReplyDelete
  3. Dada, this is first time I have tested Recursive method in any program. Just to test it I have coded the ackerman function and I found it really tests well....mmmhhh..aaa....

    You know, I just didn't even write a single line for the program, the definition was a program itself. I know its simple, but still, if you want you check it out from the following link

    http://tanmayonrun.blogspot.com/2011/06/my-works-ackerman-function.html

    ReplyDelete
  4. obviously, right at the bottom of the post I have given the download link, just download and run it.

    Give two values of m and n, then press the button, it will show you the answere.

    ReplyDelete
  5. Yeah Dada, I found some problem with big data like

    (m=4, n=1), or (m=3, n>15) etc. There is no problem with the code. But there is problem with the huge complexity arises. The program is crashing with such data.

    What do you think, will this be gone if I use BackgroundWorker????

    ReplyDelete
  6. An unhandled exception of type 'System.StackOverflowException' occurred in recursion_test.exe

    What does this mean dada? it is highlighting the declaration line of the ack(m,n) function?

    ReplyDelete
  7. hmmm...the background worker wont work as msdn is saying that this error is because of too many method calls or too much recursion.

    ReplyDelete
  8. Check this code,your logic has some error, check it for reference
    http://www.dreamincode.net/code/snippet5771.htm

    ReplyDelete
  9. try factorial or tower of hanoi using recursion

    ReplyDelete
  10. Their code is also failing to calculate m=4, n=1. And also I did not find anything else in their code. However if you have found anything, please notify me.

    I am trying to develop another way divide the recursion and save the result of each recursion. It will consume a bit memory, but right now I need this, It may also slow down the process.

    And obviously, I will try Tower of Hannoi but factorial is enough better with a 'for loop' (I think).

    ReplyDelete
  11. try this i refer this link

    http://rosettacode.org/wiki/Ackermann_function

    using System;
    class Program
    {
    public static long Ackermann(long m, long n)
    {
    if(m > 0)
    {
    if (n > 0)
    return Ackermann(m - 1, Ackermann(m, n - 1));
    else if (n == 0)
    return Ackermann(m - 1, 1);
    }
    else if(m == 0)
    {
    if(n >= 0)
    return n + 1;
    }

    throw new System.ArgumentOutOfRangeException();
    }

    static void Main()
    {
    for (long m = 0; m <= 3; ++m)
    {
    for (long n = 0; n <= 4; ++n)
    {
    Console.WriteLine("Ackermann({0}, {1}) = {2}", m, n, Ackermann(m, n));
    }
    }
    }
    }

    ReplyDelete
  12. i check the above code, there is limitation in dotnet for recursion, in the above code recursion is about 35431409 times when you give input 4,1

    Don't recurse too many times...

    ReplyDelete
  13. Yeah, I found the limitation too. I think it is in every language.

    However, I have posted two problems which will seem easy to you as I think you are a very good programmer. But still you can check them out through the following links....

    Matrix Problem 02
    Problem: In a given matrix all the cells will contain a value of 1 or 0. Change the value of a cell to 1 if the summation of its 8 adjacent cells are 3 or greater than 3, otherwise change the value to 0. Boundary cells can have 3 or 5 or less adjacent cells depending on the size of the matrix, so for boundary cells you will have to calculate over them. The number of rows and columns will be equal. For example, you might be given a 8x8 matrix. The values will be given by the user. You can keep the number of cells 8x8 or you can make it variable or user inputted.

    Tic-Tac-Toe Game
    Problem: We hope we are all known with the game Tic-Tac-Toe. Well..if we are not, we will be soon. You will not have to build any artificial intelligence for the game as the game will be played by two human, I mean users. Lets get into it.....

    Visit the links for explanations with required images and download links of the EXEs of the solutions I made.

    ReplyDelete
  14. Sure , I will see your problems when i have free time..Thank you...

    ReplyDelete
  15. Don't bother finding the problems in the lists of post, easily access them through the page My Works

    ReplyDelete

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...