Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Truncate and rebuild a table
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2014
Application:
Web
Miscellaneous
Thread ID:
01629214
Message ID:
01629219
Views:
29
>>>>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform