Thursday, December 12, 2013
Saturday, July 20, 2013
SQL Server Solve Error: Database diagram support objects cannot be installed because this database does not have a valid owner
Hello friend, In this post i would like share solution of one small problem, which occurs many times in SQL Server.
When we restore Database to any other server and try to create database diagram then it does not allow to create database diagram and its give error
Error:
Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects
Solution is very small. just execute below query:
Replace MYDB with your DB name then execute the query
ALTER AUTHORIZATION ON DATABASE::MYDB TO sa
After executing above query we can create DB diagram
Thursday, July 18, 2013
C Programming Questions and Answers, C Interview Questions, GATE previous year Questions in C Programming
Hello friend, In this post I am going to create a huge collection of all types of Questions with Answers. Wherever I will find any question that is important for GATE or any interview, I will post it here
For programming in C/ C++, you can use Dev C++ IDE, it is free IDE for C and C++ developer, Link to download
Q. What is the difference between the declaration and definition of a variable?
Ans: The definition is the one that actually allocate space, and provides an initialization value, if any. There can be many declaration, but there must be exactly one definition
Q. What is the difference between a statement and a block?
Ans: A statement is single C expression terminated with a semicolon. A block is a series of statements, the group of which is inclosed in curly braces.
Q. How to add two numbers without using arithmetic operators?
OR
Q. Write a function that returns sum of two integers. The function should not use any of the arithmetic operators (+, ++, -, --, .. etc).
Ans: We can not use arithmetic operator but we can use C Bitwise Operators, below is the function that will add two number without using arithmetic operators
int AddNumbers(int x, int y)
{
if (y == 0)
return x;
else
return AddNumbers( x ^ y, (x & y) << 1);
}
Q. How many squares does a chess-board contain?
Ans: Total number of squares = 8²+7²+...+1² = 204
This concept can be generalized to calculate number of squares in any N*N matrix
1² + 2² + 3² + ....n² = n(n+1)(2n+1)/6
Q. How many rectangles does a chess-board contain?
Ans: Total = [n(n+1)/2]^2
Here n is 8