SQL Server 2005 rowid - invalid coulmn name

SQL Server 2005 ROWID -  invalid column name  I keep getting an invalid column name message from the attached code...  The trigger works if I comment out the where clause...  I even tried using the row number function  -  SELECT ROW_NUMBER () OVER (ORDER BY id) AS ROWID FROM dbo.
able1; no luck.  Your help is appreciated!  Am I  missing a declaration or what?
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 
CREATE TRIGGER trg_New_Trigger
   ON  dbo.Table1
   FOR INSERT,  UPDATE
 AS
 
BEGIN
                 SET NOCOUNT ON;
UPDATE dbo.Table1
SET dbo.Table1.Target_Column = (Select substring(cast(getdate() AS CHAR(11)),10,2) + cast(inserted.ID AS CHAR(10))
                                     From inserted)
WHERE dbo.Table1.ROWID IN (SELECT ROWID FROM inserted)
END
GO

Open in new window

stang1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
is ROWID an existing column in your table?
in other words, what is the primary key column of your table?
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
say, the PK column was named PK indeed:
CREATE TRIGGER trg_New_Trigger
   ON  dbo.Table1
   FOR INSERT,  UPDATE
 AS
 
BEGIN
                 SET NOCOUNT ON;
UPDATE t1 
SET Target_Column = substring(cast(getdate() AS CHAR(11)),10,2) + cast(i.ID AS CHAR(10) )
  FROM dbo.Table1 t1
  JOIN inserted i
    on i.PK = t1.PK
END

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stang1Author Commented:
It worked, thanks!  Your rank describes you well....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.