Thursday, March 8, 2012
cannot create a simple table
how sql works, to aid me in my transition im the microsoft press SQLServer
2000 book and am trying to follow the simple instructions to create a table,
the script is very simple:
use northwind
create table investors
{
IvestorID int not null,
FirstName varchar(30) not null,
LastName varchar(30) not null
}
and ive made sure that ive copied it exactly but its still not working. IM
using the personal edition to get to grips with it before using the one at
work. Im logged in using windows authentication as the user Laptop/Dr patel
which is my username, and should have full database admin rights however i
get the following result when i run the above sql:
[Microsoft][ODBC SQL Server Driver]Syntax error or access violation
what am i doing wrong?use northwind
GO
create table investors
(
IvestorID int not null,
FirstName varchar(30) not null,
LastName varchar(30) not null
)
Your curly {} brackets were wrong.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"DowningDevelopments" <DowningDevelopments@.discussions.microsoft.com> wrote
in message news:90D63350-D145-4C98-9194-439CD14CC778@.microsoft.com...
> hello im brand new to SQL server but im very well versed in access so i
> know
> how sql works, to aid me in my transition im the microsoft press SQLServer
> 2000 book and am trying to follow the simple instructions to create a
> table,
> the script is very simple:
> use northwind
> create table investors
> {
> IvestorID int not null,
> FirstName varchar(30) not null,
> LastName varchar(30) not null
> }
> and ive made sure that ive copied it exactly but its still not working. IM
> using the personal edition to get to grips with it before using the one at
> work. Im logged in using windows authentication as the user Laptop/Dr
> patel
> which is my username, and should have full database admin rights however i
> get the following result when i run the above sql:
>
> [Microsoft][ODBC SQL Server Driver]Syntax error or access violatio
n
> what am i doing wrong?
>|||Noooo, I figured it had to be something stupid like that!!!
thanks Mike
"Mike Epprecht (SQL MVP)" wrote:
> use northwind
> GO
> create table investors
> (
> IvestorID int not null,
> FirstName varchar(30) not null,
> LastName varchar(30) not null
> )
> Your curly {} brackets were wrong.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "DowningDevelopments" <DowningDevelopments@.discussions.microsoft.com> wrot
e
> in message news:90D63350-D145-4C98-9194-439CD14CC778@.microsoft.com...
>
>
Saturday, February 25, 2012
Cannot connect to the SQL 2005 Express
I created test project and want to use SQL 2005 database inside.
1. I created Test database with DEFAULT rights
2. I go into server explorer, press Add Connection. Shows message box for connecting to the server: <PCNAME> using windows authntification.
But NO database allowed to view :(.
Which setting should be set for SQL server database to i could connect and work with it?
P.S I use LOCAL connection. The Application and Server should be on the same PC.|||sqlexpress is a named instance with instance name as "sqlexpress". For local connection, your connection string can be ".\sqlexpress", "(local)\sqlexpress", "<machinename>\sqlexpress", and e.t.c..
some other useful info: http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx
|||I do not use connection string - I use Visual Studio User Interface for connecting. I could try to connect as blind but I want to get list of the databases and connect on click.
Could you please give me advice how I could to do that?
|||In Visual Studio, click Connect to Database in Server Explorer. Under Choose Data Source, select Microsoft SQL Server. Under Data Provider drop-down list, select .NET Framework Data Provider for SQL Server and click Continue. On the Add Connection window, in the Server Name drop-down list, either you type .\SQLEXPRESS or select it in your list. Select the database in the drop-down list and click Test Connection. Once you're done, you now have this connection in your SQL Server 2005 Express database from Visual Studio 2005|||bass_player wrote:
On the Add Connection window, in the Server Name drop-down list, either you type .\SQLEXPRESS or select it in your list. Select the database in the drop-down list and click Test Connection.
I CANNOT SEE ANY databases, so I CANNOT SELECT invisible (for me) database and because I ask - WHICH RIGHTS I should to set in MS SQL Express to Databases could be visible.
Server list - exist (one server: <PCNAME>)
Databases list is EMPTY!!!!!!
|||The list is for server, a server can host multiple databases. In order to see your local server in the drop down list, you need to have your SQL Browser running. Did you try to type ".\sqlexpress"?
|||
Aaaaaaa!!!....
I've understood. You all were right. .\sqlexpress is required - and all works.
Thanx bass_player and Xinwei Hong - MSFT
Tuesday, February 14, 2012
Cannot connect to locally SQL Server in C#.net 2005 Express
I am trying to do the Chapter 1 project of Getting Started with ADO.net 2.0 Step by Step (microsoft press)...
I enter the data source configuration wizard and select database, and press next.
I then press the new connection button, and the Choose data source screen appears.
In the List are only 2 options:
Microsoft Access Database File
Microsoft SQL Server Database File.
The option they want me to choose does not appear in the list.
Microsoft SQL Server sqlclient
I tried following the instructions in this thread [http://forums.microsoft.com/msdn/showpost.aspx?postid=85686&siteid=1] where a user had a similar problem, but had no success.
I have reinstalled C#, reinstalled SQL Server Express 2005 with Advanced Tools, but neither helped.
Any help would be greatly appriciated.
sao123
This seems like a difference between Express and Pro edtions of these products. The connections between VS and SQL are slightly different in the Express Edtions of VS. I've read parts of this book and you have to modify the connection instruction when you're using an Express Edition, the book assumes you're using VS Pro.
I found you could either must make a copy of the database into each project and change the connections to be User Instance based, our you could manually Attach the database to the SQL Express Parent and then modify the connection strings manually an not follow the instructions in the book.
Mike
Cannot connect to locally SQL Server in C#.net 2005 Express
I am trying to do the Chapter 1 project of Getting Started with ADO.net 2.0 Step by Step (microsoft press)...
I enter the data source configuration wizard and select database, and press next.
I then press the new connection button, and the Choose data source screen appears.
In the List are only 2 options:
Microsoft Access Database File
Microsoft SQL Server Database File.
The option they want me to choose does not appear in the list.
Microsoft SQL Server sqlclient
I tried following the instructions in this thread [http://forums.microsoft.com/msdn/showpost.aspx?postid=85686&siteid=1] where a user had a similar problem, but had no success.
I have reinstalled C#, reinstalled SQL Server Express 2005 with Advanced Tools, but neither helped.
Any help would be greatly appriciated.
sao123
This seems like a difference between Express and Pro edtions of these products. The connections between VS and SQL are slightly different in the Express Edtions of VS. I've read parts of this book and you have to modify the connection instruction when you're using an Express Edition, the book assumes you're using VS Pro.
I found you could either must make a copy of the database into each project and change the connections to be User Instance based, our you could manually Attach the database to the SQL Express Parent and then modify the connection strings manually an not follow the instructions in the book.
Mike