Making SQL Server a Linked Server [closed] - sql

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a production database off site on another box which I reference by IP. Lets say its IP:
123.45.67.89
Now I want to do a query that references both my server here locally called MYSERVER1 with my production server.
When I try to do:
select count(*) from [MYSERVER1].MyDBName.dbo.mytable;
everything is fine. But I can't do this:
select count(*) from [123.45.67.89].MyDBName.dbo.mytable;
Is there a way to link the servers? Like using sp_addLinkedServer?
I get this error:
Msg 7202, Level 11, State 2, Line 3
Could not find server '123.45.67.89' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
Any ideas? (I want to copy X number of rows to my production server, that's why)

In SQL Management Studio add your remote server: first connect to your local server, go to Server Objects\Linked Server in the Object Explorer and right click and add a new one.
BTW: you can also do it with system storedprocs, but it is something that you do only occasionally I would stay with the GUI.

Related

Create Agent Job [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How to Create Agent Job In SQL Server
Follow the steps listed below:
Start SQL Server Agent Service from your ssms
Expand SQL Server Agent
Right Click on Job select New Job
Enter Your Job name and description
Select your database then Write your Procedure or Query in command
Select Scheduler and Schedule your job and set time when you want to run it
You can execute your job manually -right click on your job an dclick on Start Job at Step

How to unlock superuser 'postgres' account in postgresql [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
While connecting to the pgadmin database postgres with correct password, I'm getting the following error:
'Error connecting to the server:FATAL password authentication failed with user 'postgres'.
After changing the method to 'trust' instead of 'md5' in hba config file, and then typed:
ALTER USER POSTGRES WITH PASSWORD 'newpassword'
after again changing the methods as md5 then tried connecting to database
Howerver the password changed successfully (I checked in encrypt mode and it was fine) but getting the same issue:
'Error connecting to the server:FATAL password authentication failed with user 'postgres'.
Kindly suggest me if there are any other solution for this issue.
This suggests to me that either you are authenticating against an outside source (not common) or somehow you have been bitten by a bug in pgAdmin that set validto to an invalid date (more common).
Try this:
ALTER USER postgres VALID UNTIL 'infinity';
Or you can set the valid until value to something more limited if you want to lock the account after a certain time period.

How to copy structure of database in another database in sql server 2008? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i have a database and want to copy all the tables in new database without copying the dat of all those tables only structure should be copy
SQL Server Management Studio offers the following:
Scripting the whole database:
Under the Object Explorer, right mouse click on the database and then select Script Database as
To script just (specific) tables:
In Object Explorer, right mouse click on the database, select Tasks, then Generate Scripts, and then select the tables that you want.
You can then use the script to create a new database / new objects elsewhere. If you change the name of the database, remember to change the USE xxx statement(s) accordingly.
In SSMS for your first database right click on the datbaase name then "Script Database as" > "CREATE To" then choose your output location and run your script.
Edit:
Note you will need to amend the script to specify the new database name, replacing the existing one in the generated script (courtesy of Oded comment).
In the SQL server Management Studio you can right click the database -> tasks -> export data. Then follow the wizard..

I can't login with a user I created in sql azure [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I created a login and a user in sql azure but i'm not able to login...
I can connect only with the administrator account...
How do I login with the user I created?
I've been struggling with this too, and after some research it appears that only LOGINS can login. A User (created in a specific database, from a login) is only a "persona" that a login assumes when accessing that particular database.
So, again, you can't login as a User, only with a Login. If your intention is to somehow create restricted access to a specific database then you need to do some work: I'm currently looking at the following article:
http://blogs.msdn.com/b/benjguin/archive/2012/01/21/sql-azure-create-a-login-that-has-only-access-to-one-database-sql-azure-cr-233-er-un-login-qui-n-a-acc-232-s-qu-224-une-base-de-donn-233-es.aspx
HTH.
If you're trying to use SQL Server Management Studio you need to specify the database that you want to connect to (Login screen -> Options -> Connection Properties) as by default new logins do not have access to the master database which SSMS will try to open if a database is not specified.
Windows Azure SQL Database security works mostly like standard SQL Server, in that you have to ensure that you have a server login created for that user, as well as a user created in the database linked to the login. Look at the Docs for more information to make sure you aren't missing a step: http://msdn.microsoft.com/en-us/library/windowsazure/ee336235.aspx

Error #1044 - Access denied for user 'root'#'localhost' to database 'information_schema' [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Alright, so here is the scenario
I performed a full backup on my mysql server today. Now when I try to import that .sql dump file, I get the error mentioned in the title and it does not load all the other databases.
How can I get around this so phymyadmin will allow me to import the whole file, or is there a way I could "remove" information_schema from the sql dump
Thanks
As Dan Grossman said:
To "remove" information_schema from the dump, open the file in notepad
and delete those lines. It's just a text file of sequential queries to
run.
Open information_schema and run
FLUSH TABLES
This should clear the information_schema CACHE and will stop the error as it "resyncs" the tables to the latest schema
I use a program called Notepad++.
You open your sql file and the program will put it in a way where you can clearly see what the information_schema database is trying to do and why it is failing every time. You can safely remove that part of the database.
Then I install a WAMP on my pc, run a mysql program (mysql front) and import the database. After importing I have full access to the tables and databases.
Just export what you want and then just import then to your new database.
CREATE a new database and then then try to connect using that new db then run the schema and then try to execute the databases.