>>>>>Hi,
>>>>>
>>>>>Is it unconventional or maybe "harmful" to a SQL Server if I have a procedure that truncates a table and than inserts new records into this table (basically rebuilds it). The table itself (which stores some calculated values) is on average about 50 records/rows and it has about 60 columns. This procedure, "truncating and re-inserting" would happen about 1000 times a year. At most I see it occurring 10,000 times a year.
>>>>>
>>>>>What do you think?
>>>>
>>>>Why you need this?
>>>>1. Create SP that will return calculated records.
>>>>2. Create Table valued function.
>>>>3. Create View
>>>
>>>I think the above three cases are the three alternatives, right? If so.
>>>1. I have not thought about this. But given that SQL Server is very fast this could be a viable alternative. I will explore this.
>>>2. I am not familiar with this feature
>>>3. I am not familiar with this feature.
>>>
>>>But I will explore the 1st approach.
>>>
>>>Thank you.
>>
>>
>>Table valued functions are like normal functions but they return table.
>>The best of Table valued functions is that you can use them in query like regular table.
>>Something like that:
>>
>>SELECT * FROM MyTable
>>INNER JOIN dbo.SomeTableFunction(parameter1, ..., parameterN) Tbl ON ...
>>
>>
>>or even:
>>
>>SELECT * FROM dbo.SomeTableFunction(parameter1, ..., parameterN) Tbl
>>INNER JOIN SomeTable ON ...
>>
>
>Thank you very much for the examples.
Here one very good explanation for Table Valued functions:
http://www.codeproject.com/Articles/167399/Using-Table-Valued-Functions-in-SQL-ServerIf you google "table valued function sql server" you will see many good examples :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.