March 21, 2012 at 3:17 am
L' Eomot Inversé (3/20/2012)
But the question doesn't say "required to hold the create view statement ... It says "required for the the create view statement"
I've read this several times and am still struggling to see the difference 🙂
March 21, 2012 at 3:20 am
Irony overload.
March 21, 2012 at 11:47 pm
Nice basic question and nice conversation...
Thanks
March 22, 2012 at 7:30 am
I'm probably exposing my ignorance here but with a view on just one table is there any difference between having an index on the view and having an index on the relevant columns in the table the view looks at?
March 22, 2012 at 7:39 am
marlon.seton (3/22/2012)
I'm probably exposing my ignorance here but with a view on just one table is there any difference between having an index on the view and having an index on the relevant columns in the table the view looks at?
Yes. An indexed view is materialised, in other words, stored separately from the base data. If the view is not indexed then SQL Server still has to execute the view's SELECT statement in order to get the data.
John
March 22, 2012 at 7:40 am
marlon.seton (3/22/2012)
I'm probably exposing my ignorance here but with a view on just one table is there any difference between having an index on the view and having an index on the relevant columns in the table the view looks at?
An index on the view persists this view to the database.
If it makes a difference regarding performance: it depends 🙂
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 22, 2012 at 12:16 pm
We can't forget to count the amount of space these blog posts add to non-indexed views.
My non-indexed view is that replacing "for the CREATE VIEW statement" with "to create views" would have made "correct" correct.
In any case, Ron, thanks for the question and all your numerous excellent contributions to this web site.
Chris
April 2, 2012 at 7:13 pm
Good straightforward question. Thanks for submitting.
http://brittcluff.blogspot.com/
October 10, 2012 at 1:49 am
can anyone tell me how to add a constraint to a already created view?
I write as-
alter view chk_sales
as
select * from SalesDates,
add chk_unique constraint unique (id>2)
this is giving me error...
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
October 10, 2012 at 1:53 am
sorry I pasted wrong query-
this is the query below in which I am getting error-
alter view chk_sales
as
select * from SalesDates,
add constraint chk_unique unique values (id>2)
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
October 10, 2012 at 1:58 am
This was removed by the editor as SPAM
October 10, 2012 at 3:46 am
kapil190588 (10/10/2012)
can anyone tell me how to add a constraint to a already created view?I write as-
alter view chk_sales
as
select * from SalesDates,
add chk_unique constraint unique (id>2)
this is giving me error...
You cannot create any constraints on views,
You can, however, create indexes on views. The first one you create has to be a clustered unique index; after that you can continue to create additional nonclustered indexes, that can be unique or nonunique, can include additional columns, and can be filtered. Using unique indexes on a view is a way to mimic the behaviour of constraints - but my recommendation is to do this only when required (which, since the addition of filtered indexes in SQL Server 2008, should be almost never); it's much better, both for performance and for future maintenance, to put constraints on the base tables.
October 10, 2012 at 3:56 am
hi Hugo,
thanks a lot....
I am new in area of DBA so can you plz suggest how can i improve my skills in sql area..
any site or books?
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
October 10, 2012 at 5:04 am
kapil190588 (10/10/2012)
hi Hugo,thanks a lot....
I am new in area of DBA so can you plz suggest how can i improve my skills in sql area..
any site or books?
The most important thing is to get practice. As much as you can get. If you haven't already, install an instance of SQL Server on your private laptop and/or home desktop. SQL Server Express edition is a free download that enables you to play around with most features; if you need acccess to the full feature set, you can buy Developer Edition for, I think, about 50 dollars per license. (I think you will need one license for each computer you install it on). Developer Edition gives you access to the full feature set of Enterprise Edition, but the license does not cover production use - development and testing only.
It's also very important to know where to ask for help. Always try to find a solution first, using Books Online, trial and error, and Google/Bing - but don't hesitate to ask for help if needed. There are forums on this site, but there are also forums on many other sites. The most popular are probably the MSDN forums. Also, if you're on Twitter, you can get quick answers to short questions by using the #sqlhelp tag.
For reading, I can recommend lots of sites. MSDN is mostly reference. This site has lots of articles, but unfortunately, the quality varies from extremely good to extremely bad, and everything in between. When you read an article here, always check if there was any debate on the forums (each article has a link to it's own forum discussion, just like the daily questions), and then still double check what you read. The daily question here is also nice, but beware that question authors often focus on edge cases, whereas in your actual work you will need the normal stuff most often.
A source of very high quality information is the blogger site sqlblog.com. (And I'm not saying that becuase I blog there, but because there are many great bloggers there - and note that there are also many great bloggers who blog elsewhere, so don't limit yourself to just that one site). However, due to the nature of blogs, it may be hard to find material of your own level.
It's hard for me to recommend books, as I don't read that many books - and those I do read are not really targeted at the beginner level. One book I can recommend wholeheartedly is Paul Nielsens "SQL Server 2008 Bible". (For full disclosure, I will say upfront that I was involved in the production of this book - I was the lead technical editor. I was payed a fixed amount for this, so I have no financial interest in driving its sales). I believe this book does achieve what it sets out to do - cover almost everything in SQL Server, starting at a level suitable for relative newcomers, but not stopping short of the more advanced stuff.
Be warned that this is a pretty hefty volume. Don't plan to read it on a plane, you'll have to pay for excess weight. And check it out before buying, it may be more than you need at this time. I think there is also a "SQL Server 2012 Bible", but I have not seen any of its contents, so I can't comment on the quality. I know that Paul Nielsen, the original author of the "SQL Server ... Bible" series, was no longer involved in this edition.
For more book reading suggestions, you might want to start a new discussion in an appropriate forum and see what other suggestions you get.
October 10, 2012 at 5:13 am
thanks for your suggestion Hugo
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Viewing 15 posts - 31 through 45 (of 45 total)
You must be logged in to reply to this topic. Login to reply