473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Using SQL Developer to work on SQL Server

Good morning,

I have a SQL Server Database I am working on and only have SQL Developer to work on it and I am coming up with lots of issues to getting some basic stuff to work.

All I am really trying to do is rename a query but it simply will not work, here is what I have tried.

sp_rename 'Contact2', 'Contact4' - which gives me a command unknown error

EXEC sp_rename 'Contact3, 'Contact4' - Incorrect syntax near the keyword 'BEGIN'

ALTER TABLE CONTACT3 RENAME TO CONTACT4 - Incorrect syntax near the keyword 'TO'

ALTER TABLE RENAME CONTACT3 TO CONTACT4 - Incorrect syntax near '.'.

So I figured if I couldn't change the name I could recreate the table so tried

CREATE TABLE CONTACT4 AS (SELECT * FROM CONTACT2); - Incorrect syntax near the keyword 'AS'.

I have tried several other variations but can not remember them all now.

Can anyone please tell me how to rename an SQL Server Table using SQL Developer?

Thanks
Dec 21 '11 #1
14 3684
ck9663
2,878 Expert 2GB
I'm not sure what a SQL Developer is. If you have a SQL Server, shouldn't it be installed with a SSMS of some sort?


~~ CK
Dec 21 '11 #2
NeoPa
32,556 Expert Mod 16PB
Is it a query (View) or as table you're trying to rename? Your question indicates both.
Dec 21 '11 #3
SQL Developer is an Oracle SQL Development Environment.

I am trying to change a table.

The problem is that I have a database in SQL Server which depends on having a specific column as the last column and so in order to add a new field I need to take the table and recreate it with the additional column and then drop the original table and rename it. but for some reason I can't get it to rename.
Jan 5 '12 #4
Rabbit
12,516 Expert Mod 8TB
1) Why are you using an Oracle product to connect to a Microsoft product?
2) Didn't SQL Server come with SQL Server Management Studio?
3) A database never requires having a column in a certain position. Only processes external to a database object itself would have that kind of restriction. What process is it that you're trying to accomplish?
Jan 5 '12 #5
All very good points I knew someone would ask.

1) My company only uses Oracle databases with this one exception.
2) No, The programme was installed by an outside contractor who did not install SMS.
3) We are using GoldMine CRM, for some reason known only to Frontrange the last column of each table must be the recid column (All columns after this are ignored by the front end) in order to add a new column into the database it is necissary to add it before the recid column, GoldMine can do this itself but this system has all the data on it for 10 years of business and so to add a column from the front end would mean a considerable amount of network strain and in my company this system is a bit of a hot political issue (It was installed without our IT departments consent) it is therefore unlikely to go down well if I start bringing down our batch processes by adding to an already over loaded network.

So whilst I agree with all of your points and they were ones i would have made myself two months ago I find myself stuck using the wrong tool to manipulate a bad system. SQL Developer does state that it includes SQL Server compatability so I am sure it must be possible and I can do most things through SQL Developer (Make Table, Drop Table, Add Fields, Ammend Data) I just can't rename anything (i tried adding a field to the end of the table and renaming it recid but that didn't work either.
Jan 6 '12 #6
Rabbit
12,516 Expert Mod 8TB
I have not used GoldMine CRM but have you tried using a view instead? You can use a view to give the illusion of a different column order. This way, you can forego the entire process of make new table, copy over data, drop old table, rename new table.
Jan 6 '12 #7
Unfortunatley it has to be a change to the table otherwise it will not get picked up by the front end.
Jan 6 '12 #8
Rabbit
12,516 Expert Mod 8TB
Just a heads up, in your second rename attempt, you're missing a closing quote.

And if you're trying to select everything from one table and put it into another, creating it in the process, the syntax is
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. INTO newTable
  3. FROM oldTable
Jan 6 '12 #9
Rabbit
12,516 Expert Mod 8TB
Not if you use the view as the source for the front end.
Jan 6 '12 #10
NeoPa
32,556 Expert Mod 16PB
Adam Brown:
Unfortunatley it has to be a change to the table otherwise it will not get picked up by the front end.
I believe Rabbit's post #10 is in response to this (quoted) statement. I would tend to agree. I see no reason why the front end would have any more difficulty reading from a correctly organised view than it would from a table.
Jan 6 '12 #11
Unfortunatley I can not adjust the front end so it needs to be the contact2 table.
Jan 13 '12 #12
NeoPa
32,556 Expert Mod 16PB
That certainly complicates matters for you.

May I suggest, only as a point to consider - I cannot say if this will be fully appropriate in your circumstances, that you provide the view named as [contact2] anyway. This would certainly involve renaming the table in order to avoid confusion, but it might solve this particular problem.
Jan 13 '12 #13
I understand where that could be useful, unfortunatley it is the problem of being unable to rename a table that is causing the issue in the first place.
Jan 16 '12 #14
NeoPa
32,556 Expert Mod 16PB
Adam Brown:
unfortunatley it is the problem of being unable to rename a table that is causing the issue in the first place.
Is that manually or in code that you mean? I ask because my suggestion was to do that manually on the server, which should be fairly straightforward I would assume.
Jan 16 '12 #15

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

Similar topics

6
by: M P | last post by:
Need help! Whats wrong with my code? My plan is this, I have my IIS5.0 on Server A and then I will use SMTP service of Server B. I already configured IIS to use Server B as its SMTP Server but I...
11
by: Andy | last post by:
Hi Gang Our network administrator does not want to install the IIS SMTP server on our intranet. He wants me to use our existing SMTP server "mail.smpi.siemens.ca". Can I do this with IIS?? Is...
0
by: Robert Tackett | last post by:
I am using Visual Studio.NET on a Windows XP Professional box running IIS and SQL Server 2000 Developer and everything is working fine. I would like to use a Windows 2003 Server running IIS6 and SQL...
3
by: Mark | last post by:
Hi, How to add a foreign key constraint using the SQL server 2000 enterprise manager? Not by SQL. thanks
3
by: Brian Kwan | last post by:
Project Description: Develop a web application to help manage sale operations. There is a function that to generate a report using data in database, which is a Word document on server and let user...
0
by: anoj | last post by:
Hi Guys, I need some sample code in C# to perform below tasks using MS-Exchange server: a) Read mails from server b) download attachements c) delete the mails from server Thanks in...
0
by: Maxx57 | last post by:
C# VS.Net 1.1 (2003) - trouble with using IE proxy server settings I've got a program that detects if it can connect to a webservice. It sends a System.Net.WebRequest and then checks the...
1
by: DC | last post by:
Is ther an easy way of using the HTTP_REFERER server variable to choose between 2 different includes files? Eg: <% If HTTP_REFERER="Url 1" then <!--#include...
2
by: ALMISHGARI | last post by:
I Need The Code That Used To Attach Bar Code Device With Form Builder Block Using Developer 6i: For Example : I Want To Read Product_no Using Bar Code Device To Display The The Product_no And It...
2
by: brettokumar | last post by:
hi i my pro im using orcale client server while i m using update query i run properly. but instead of query im using storeprocedure i can not execute it display error like 'invalid sql statement '...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.