By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

MS Sql Server Express vs. Visual Studio? Embedded DISTINCT functionality?

P: 2
I've been having issues running certain commands in Sql Server Express 2008.

One of the specific commands in question looks like this:

Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(DISTINCT Sno) as NumberShipping

This commands works perfectly in visual studio 2008, but I get an error in sql server express.

The error is:
There was an error parsing the query. [ Token line number = 1,Token line offset = 14,Token in error = DISTINCT ]

I was also unable to use varchar(), float, real, and have been unable to get an "except" statement working. Does sql server express not support these commands, or did I more than likely end up with a bad installation?

Oct 11 '10 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 15k+
P: 31,476
Try :
Expand|Select|Wrap|Line Numbers
  1. SELECT   Count(*)
  2. FROM     (
  4.     FROM   [Shipment]
  5.     )

Joe Willis:
BTW: I'm wondering if my SQL Server Express installed correctly. Currently, it doesn't recognize varchar's, and I have yet to be able to get an "except" clause working without an error.
Sounds like a completely separate question. If you're interested, then post a new thread. It's not relevant here.
Oct 11 '10 #2

Expert Mod 15k+
P: 31,476
Joe, I know you posted the first time before registering, but do you really think double posting your question will get you help any quicker?

I suggest all you'll get is grief from all the experts whose time you've wasted. Not a great start.

PS. I've moved the other response in here and deleted the older thread. If the response isn't an exact match to the question then you know why.
Oct 11 '10 #3

P: 2
I'm sorry NeoPa, I couldn't find my original post before registering.

Expand|Select|Wrap|Line Numbers
  3.     SELECT   Count(*)
  4.     FROM     (
  5.         SELECT DISTINCT [SNO]
  6.         FROM   [Shipment]
  7.         )
I had tried this aswell. Didn't work in sql express 2008.

On a side note, both of the above queries work in visual studio.
Oct 11 '10 #4

Expert Mod 15k+
P: 31,476
Joe Willis:
On a side note, both of the above queries work in visual studio.
Bearing in mind Visual Studio is simply a view by which you see whichever SQL Server you're using, I'm guessing this is actually referring to a full SQL server. I have no idea why the Express edition would behave any differently from the full edition, but that would be the best area to look in if that's the case. It would be a surprise for me I admit, but if that's what you're seeing I doubt playing with the SQL code will help greatly.
Oct 11 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.