SQL FAQ

How to rename an SQL Server computer?  If you are running SQL Server 7.0, after renaming the SQL Server machine, the SQL Server service will...
How to rename an SQL Server computer? 

If you are running SQL Server 7.0, after renaming the SQL Server machine, the SQL Server service will fail to start, with an error message "Your installation was corrupted or had been tampered with. To get around this problem, you have to rerun the SQL Server setup. Setup will prompt you to upgrade. After doing so, the necessary SQL Server registry entries will be reset with the new computer name. Now you will be able to start SQL Server. After restarting, use Query Analyzer to  run the following commands:
EXEC sp_dropserver 'Your_OLD_Computer_Name'
GO

EXEC sp_addserver 'Your_NEW_Computer_Name', 'local'
GO


Restart your SQL Server service. Connect using Query Analyzer and run the following command (It should output the new server name):
SELECT @@SERVERNAME
GO
If you are running SQL Server 2000, the new name is recognized, the next time SQL Server service starts. You don't have to rerun the setup. However, you have to run the sp_dropserver and sp_addserver stored procedure as shown above.

I forgot/lost the sa password. What to do? 
Forgot or lost your sa password? Don't worry, there is a way out :)

Login to the SQL Server computer as the Administrator of that computer. Open Query Analyzer and connect to SQL Server using Windows NT authentication. Run 
sp_password as show below to reset the sa password:
sp_password @new = 'will_never_forget_again', @loginame = 'sa'

I have only the .mdf file backup and no SQL Server database backups. Can I get my database back into SQL Server? 
Yes. The system stored procedures sp_attach_db and sp_attach_single_file_db allow you to attach .mdf files to SQL Server. In the absence of the log file (.ldf), SQL Server creates a new log file.
How to add a new column at a specific position (say at the beginning of the table or after the second column) using ALTER TABLE command? 
ALTER TABLE always adds new columns at the end of the table and will not let you add new columns at a specific position. If you must add a column at a specific position, use Enterprise Manager. In Enterprise Manager, right click on the table, select 'Design Table'. Right click on the desired location and select 'Insert Column'. Mind you, Enterprise Manager drops and recreates the table to add a column at a specific location. So it might take a long time if your table is huge.

How to change or alter a user defined data type?
Unfortunately, there is no easy way to alter or modify a user defined data type. To modify a user defined data type, follow these steps:
  • Alter all the tables, that are referencing this user defined  data type (UDT), using ALTER TABLE...ALTER COLUMN command and change the data type of the referencing column to an equivalent (or the intended) base data type.
  • Drop the user defined data type using sp_droptype.
  • Recreate the user defined datatype with the required changes using sp_addtype.
  • Again, use the ALTER TABLE...ALTER COLUMN syntax to change the column's datatype to the user defined data type.
How to rename an SQL Server 2000 instance? 
You cannot rename an instance of an SQL Server 2000. If you must rename an instance, follow these steps:
  • Install a new SQL Server 2000 instance with the desired name.
  • Move your databases from the old instance to the newly created instance.
  • Uninstall the old instance of SQL Server 2000.
How to backup to and restore from network drives, mapped drives or network shares?
SQL Server cannot read mapped drives. In your backup and restore commands always refer to the network drive or network share using UNC path. UNC path has the following format: \\MachineName\ShareName or \\MachineName\DriveLetter$\Path

Here is an example to backup the pubs database to a share called 'AllBackups' on a remote machine named 'BackupServer':
BACKUP DATABASE Pubs TO DISK='\\BackupServer\AllBackups\Pubs.BAK'

To backup pubs database to a the admin share 'D$' on a remote server named 'BackupServer':
BACKUP DATABASE Pubs TO DISK='\\BackupServer\D$\MSSQL7\BACKUP\Pubs.BAK'

For network backups and restores to work, make sure your SQL Server and SQL Agent services are NOT running under system account. These services must run using a domain account and this domain account must have read and write permissions on the network share or drive.




What are the effects of switching SQL Server from 'Mixed mode' to 'Windows only' authentication mode? What are the steps required, to not break existing applications? 

Switching from Mixed mode to Windows authentication is a major conversion and requires some good planning. Here are some steps you need to take:



  • Change the connect strings in all your applications to connect using windows authentication.
  • If your applications are using DSNs, you will have to alter the same, to connect using Windows authentication.
  • All your users should login using an NT account that has been granted access to the SQL Server, as well the database in question.
  • If you have old third party applications (for which you don't have source code, and are using DSN-less connections), that are written to connect using SQL Server authentication, you will have problems, as these applications will fail to connect.
  • Get rid of your current SQL Server logins and users and replace them with NT logins and grant database access to these NT logins.
  • If you have users connecting from non-windows platforms, they will not be able to connect using Windows authentication. So you might want to migrate them to Windows first.
  • Update the login information for all the replication agents and DTS packages involved, so that they connect using trusted connection.
  • In Enterprise Manager, edit the server registration properties, so that EM connects to SQL Server using Windows authentication.

COMMENTS

BLOGGER
Name

Achievements,5,Allowances,87,Amendments,3,Android Apk,3,Announcements,38,anomalies,3,Articles,30,ATM,1,Audio / Video,3,Awards,7,Awareness,3,Banking,44,Books,3,Branch Post Office,2,BSNL,35,Business,15,Cadre Restructuring,10,CAT,4,CBS,2,CBS-CTS,1,CCA,5,CCA MCQ,1,CCS Rules,12,CEA,8,CGHS,56,Clarifications,27,COD,1,Competitive Exams,15,Computer Guidelines,119,Corona / Covid-19,32,Court News,35,Customer Care,247,Defence,1,Deputation,2,Differently Abled,7,DOP News,167,DOP Orders,99,DOPT Orders,331,Drivers,5,Dte Orders,58,e-Services,29,Education,117,Elections,3,Employees News,868,Employment News,85,Entertainments,60,Events,48,Exam / Result,112,Exam / Syllabus,58,Exam News,17,Facts,3,FAQ,78,Finacle,14,Finmin Orders,8,For System Administrators,128,Forms,15,FR Quiz,5,Frauds,1,Gazette,2,GDS,43,GenEng,1,General Informations,167,General Knowledge,344,GFR,3,GK,7,GO,1,GOVT Orders,50,GPF,1,Greetings,17,Guidelines,19,Hardwares,9,HBA,9,Health Tips,38,Holiday Home,18,Holidays List,6,Honorarium / Incentives,10,Important Letters,3,Important Persons,2,Income Tax,56,Instructions,3,Interest Rate,14,Internet Tips,94,IPO,191,Judgement,19,KV Schools,13,Labour News,2,Latest Software Updates,76,LAW,15,Leave Rules,44,Letter to Dte,1,Lokpal and Lokayuktas,1,LTC,41,MA Rules,5,MACP,26,Mails,24,MCQ,1,MHA Orders,2,Miscellaneous,4,MMS,18,Mobile Tips,33,National Pension System (NPS),51,NEFT / RTGS,2,Network Trouble shooting,11,News,179,Notifications,13,OBC related,1,Operating Procedures,15,Pay & Allowances,2,Pay Commission,45,Pay Commission - 7th,34,Pay Fixation,7,Pension,144,Pensioners News,11,Persmin,35,Philately,27,PLI,1,PLI and RPLI,32,POGuide I,5,PointOfSale,4,POSB,57,POSB Clarifications,13,Postal Accounts & Finance,1,Postal Accouunts / PAO,1,Postal Exams,4,Postal Informations,150,Postal Manuals,3,Postal Savings Schemes,61,PostalHistory,2,Printer Trouble shooting,11,Printing Tips,15,Project Arrow,6,Promotions,10,Questions / Answers,51,Quiz,34,Railway,110,Rajya Sabha Q&A,1,Random,6,Recovery Tips,12,Recruitment Rules,6,Registry Tips,26,Registry Tools,11,Reimbursement,7,Reservation,2,Results,1,RICT,2,RMS,15,Rotational Transfer,2,RTI,18,Rulings,63,SanchayPost,111,SAP,1,Savings Scheme,18,SB Orders,310,SBCO,29,SBOrder2017,1,SBOrder2018,1,SBOrder2020,1,SBOrder2021,6,SBOrder2022,2,Security Guidelines,23,Security Tips,46,Seniority List,1,Software Tips,11,Softwares,24,Speed Post,1,Sports,5,SQL,49,Staffs and Welfare,200,State News,19,Stories,5,Students,4,Study Materials,186,Sukanya Samriddhi Account,7,Tax,5,Technology,29,Technology News,23,TET / TRB / TNPSC,14,Tips and Tricks,111,TN - தமிழ்நாடு,33,Tools,30,Training,32,Transfer / Postings,38,Trouble shooting,25,UnCategorized,4,Union News,90,Update,93,Useful Softwares,125,Utilities,64,Virus Solutions,23,Websites,53,Welfare,1,windows 7,12,Windows Server,10,Windows Tips,152,Windows Vista,5,
ltr
item
Postal RADAR: SQL FAQ
SQL FAQ
Postal RADAR
https://www.postalradar.com/2010/08/sql-faq.html
https://www.postalradar.com/
https://www.postalradar.com/
https://www.postalradar.com/2010/08/sql-faq.html
true
5719657340864375059
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content