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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-05-07 : 11:21:20
|
| Alireza writes "What is best way to calculate a New Id for a Field.i dont want to using Identity=true.also how can using Function Parameters as TableName.For Expamle I wrote this FunctionCREATE FUNCTION dbo.GETLastID (@TableName varchar(40) )RETURNS bigintAS BEGIN DECLARE @LASTID bigint SET @LASTID=1 SET @LASTID=(select max(ID) from @TableName ) + 1 IF @LASTID IS NULL SET @LASTID=1 RETURN @LASTID ENDbut we get error for @tablename.please help me.thanks" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-05-07 : 11:25:37
|
| look into "dynamic sql".... |
 |
|
|
|
|
|