Solved

SQL Server Express create table

Posted on 2014-03-25
3
311 Views
Last Modified: 2014-03-25
Hello Expert,

Needed a database to do some joins on lists of servers.
Downloaded MS SQL Server Express 2012.

Got my join statement to work.

Thought I could just put 'Create table' in front of it to turn the
query into a table but I get

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'select'.

So I pulled out the word 'select'
and I get

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'Change_short$'.

I could have sworn I have done this before.
but it looks like they have changed the syntax.
Like whats up with all the dollar signs?
And how do i create tables and views?

Thanks.

Allen in Dallas
 



+++++++++++++++++++join statement begin+++++++++++++++++++++
select

     Change_short$.Name, Change_short$.[IP Address], ['Srvrs Rtrs Swtches$'].Name AS Expr1, ['Srvrs Rtrs Swtches$'].IP_Address,
                         ['Srvrs Rtrs Swtches$'].Device_type
FROM            Change_short$ right JOIN
                         ['Srvrs Rtrs Swtches$'] ON Change_short$.[IP Address] = ['Srvrs Rtrs Swtches$'].IP_Address

+++++++++++++++++++join statement end+++++++++++++++++++++
0
Comment
Question by:9apit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:englanddg
ID: 39954163
Create Table <table name> as (<select statement>) should work...
0
 
LVL 11

Accepted Solution

by:
John_Vidmar earned 500 total points
ID: 39954352
Before the from-clause, use an into-clause:
select ...
into <table name>
from ...
where ...
...

Open in new window

0
 

Author Closing Comment

by:9apit
ID: 39954484
this worked
select
     Change_short$.Name, Change_short$.[IP Address], ['Srvrs Rtrs Swtches$'].Name AS Expr1, ['Srvrs Rtrs Swtches$'].IP_Address,
                         ['Srvrs Rtrs Swtches$'].Device_type
into server2
FROM            Change_short$ right JOIN
                         ['Srvrs Rtrs Swtches$'] ON Change_short$.[IP Address] = ['Srvrs Rtrs Swtches$'].IP_Address

Thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question