I am tring to recreate my oracle database -> sql server 2008. I never used sql server before, so I am using sql server management studio. I could create tables and views. The views I created using sql server management studio GUI has data in it.
Now, I tried to use a script to create a view. The view was created but no data in it... I am sure that I'm missing some basic things.
Anybody please tell me what am I missing?

USE[DB101] 
GO
CREATE VIEW TEST 
AS
SELECT     dbo.EMPLOYEE.EMPID, dbo.EMPLOYEE.LASTNAME, dbo.EMPLOYEE.MIDDLE, dbo.EMPLOYEE.FIRSTNAME, dbo.EMPLOYEE.STREET, 
                      dbo.EMPLOYEE.CITY, dbo.EMPLOYEE.STATE, dbo.EMPLOYEE.ZIP, dbo.EMPLOYEE.TERMS, dbo.EMPLOYEE.RATE, dbo.EMPLOYEE.QTY, 
                      dbo.EMPLOYEE.VAC_RATE, dbo.EMPLOYEE.QTY_PAID_VAC, dbo.EMPLOYEE.QTY_OVER_TIME, dbo.EMPLOYEE.[GROSS-PAY], 
                      dbo.EMPLOYEE.IDTAX, dbo.TAX.TAX_TOTAL, dbo.EMPLOYEE.OT_RATE, dbo.EMPLOYEE.NET_PAY
FROM         dbo.EMPLOYEE INNER JOIN
                      dbo.TAX ON dbo.EMPLOYEE.IDTAX = dbo.TAX.IDTAX
GO

Regards,

Recommended Answers

All 4 Replies

Thank you for your reply.
I will try.

I hate to say this but it was my mistake using inner join. I had to use left outer join in order to create this view....I'm sorry.

Member Avatar for LastMitch

I hate to say this but it was my mistake using inner join. I had to use left outer join in order to create this view....I'm sorry.

I don't have a database at home to test the query you have. The query you created looks right. It's all about using which word (INNER JOIN or OUTER JOIN) to make the query work. I'm glad you solve the issue and figuring out what word (INNER JOIN or OUTER JOIN) to used for the query to work the way you wanted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.