Solved

SQL Server Express create table

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now