开发者

What Does this mean in SQL Server 2005

I am working with Microsoft SQL Server 2005, and when I execute this query:

select 
    F.E,
    S.E 
from 
    Subject

I get these errors:

The multi-part identifier "F.E" could not be bound.开发者_StackOverflow社区 The multi-part identifier "S.E" could not be bound.

but when execute this query, it works fine

select * from Subject

What do these errors mean?


The error means that the SQL server doesn't know what F.E and S.E is.

If S refers to your Subject table, for instace, you need to assign the name S:

SELECT S.* FROM Subject S

That will fetch all fields (*) in all rows (lack of WHERE) from the table Subject which is temporarily called S.

If you want to fetch only the field E from Subject, you could write

SELECT S.E FROM Subject S

This is the exact same as writing

SELECT E FROM Subject


Sorry for wasting your stack over flow just name it as F_E not F.E

It is an identifier it doesn't have symbols like .!@#$#$%^%^&&*&() but it can have _


This means that the F and the S aliases are unknown.

select S.E
    from Subject S

You then define the alias S

EDIT #1

If you want to use those special characters, you have to use quoted identifiers.

SET QUOTED_IDENTIFIER ON
GO

select [F.E]
        , [S.E]
    from Subject

You could even have field names that include the space character.

[Postal Address]
[Family Name]
[Is Active?]
[Subject #]
[And So Forth!...]

These are some simple examples. =)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜