How to use a variable as Table Name in an INSERT INTO query

Hi,

How to use a variable as a Table Name in an INSERT INTO QUERY :

SET @MachineName = 'CBC'
SET @MyTableName = 'T_Journal_' + @MachineName

INSERT INTO @MyTableName (
MyVal
)
Values(
1
)

Any ideas ?

Ray


Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion