2

I've never worked with Views on MSSQL so I hope I'm note asking a dumb question.

I have a MSSQL database and I can easiliy retrieve information from it like:

mssql_query(SELECT tbDocs FROM tbServices);

But I can't get data from a view. For example there is a view named View_Technical_Service it gets fields from tbServices and tbCustomer. Whenever I execute a query from php like

mssql_query(SELECT tbDocs FROM View_Technical_Service);

I get a time out error msg from chrome:

Error 324 (net::ERR_EMPTY_RESPONSE):

So what's wrong? Is it not possible to get from a MSSQL View with php?

2 Answers 2

1

To answer the question, yes you can use views in the same way as tables - I do it frequently. But, you should use your DB Tool such as phpMyAdmin or SQLYog to determine if the view is working properly and that you can actually see the "view" as you expect - you should be able to look at the data exactly the same way as you would a table.

If you're using Chrome, there is apparently a rampant problem world wide with how it handles empty results, which also seems to verify that the View doesn't have, or is unable to show, any data to show you

Sign up to request clarification or add additional context in comments.

Comments

0

Yes, it works. I have tested DSN less ODBC from PHP on a Windows Apache server. BUT When I used [Table Name] in the query string it DID NOT work. I had to remove the space (TableName). So I recommend removing spaces from table names and do not rely on [ ].

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.