I have a table with 1000 records and each record is asssociated with a customer. This table will change each month.
I want to create individual views of that table based on those customers in it. So, for example if there are a total of 20 customers I will get 20 views.
Why don't you have a stored procedure that select each customer's data based on parameter for customerid? Creating a view for each customer is nothing but calling trouble in future
if you do not want to use stored procedure you can use table valued function also. so you can use the Function in place of view Ex : Select * from dbo.FN_GetDataByCustID(@CustID)
“Normalize ’till it hurts, then denormalize ’till it works.”
Thanks for the replies. In answer to "why I need to do this?" My finance people need to invoice each customer and attach the detail to each of the invoices.
I'm not new to SQL but still finding my way. I think a stored procedure or table valued function will work equally well I'm just not sure about the code syntax.
Can anyone recommend a good SQL book? I have SQL Server 2008 for Dummies but it's not helping me much. I need something that's less about the design and management of databases and more about manipulating data, complex querying and reporting.