Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sam_varg007
Starting Member
8 Posts |
Posted - 2002-03-11 : 12:21:37
|
| Hi I am using SQL Server 2000 can I use insert and update staments in user defined functions. I am able to use select statments but I am getting error Invalid use of 'UPDATE' within a function. My statment was update table1 set field2=1 where field1 = 'A'. Is there any way to resolve this. ThanksSam |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-03-11 : 12:26:34
|
| According to Books Online, under the "CREATE FUNCTION" statement:Creates a user-defined function, which is a saved Transact-SQL routine that returns a value. User-defined functions cannot be used to perform a set of actions that modify the global database state.You would need to remove the UPDATE function and run it as it's own statement.Can you post the code for your function, and a brief description of what it does? There may be another way to accomplish it. |
 |
|
|
|
|
|