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
Solved

SQL Server Express create table

Posted on 2014-03-25
3
307 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
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

856 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