I Need To Make A Minor Change To A SQL Server Script That Is In Production. Need Advice So I Don't Screw Something Up.
Mar 1, 2007
Hello. I am not very strong with SQL server. But I know enough to get my way around. The reason I am asking for
help is that I need to change a SQL server script that resides on one of the production database servers of the
company I work for. I just need to add two new lines to the stored procedure.(See the lines that are bolded.) These
values are [MO_FAX],[MO_EMAIL].
Can someone tell me if there is a best way of going about doing this? Can I just simply open up SQL server and
quickly make the change? The big issue here is that this script is used in production. So I am just a little worried
about screwing something up. Anyway, I would appreciate some good advice on this?
/* Returns all data given the region and country */
ALTER PROCEDURE [dbo].[GetAllInfomration]
AS
SELECT
[COUNTRY],
[Company_NAME],
[CompanyAddress],
[CompanyPhone],
[MO_FAX]
[MO_EMAIL]
[CompanyFax],
FROM [InfoLookup].[dbo].[Company_Contact]
RETURN
View 5 Replies
ADVERTISEMENT
Oct 17, 2014
I keep getting requests to increase the width of a varchar colum every now and then.
I want to ask if its perfectly ok when you have active users connecting to the application to do this?
View 7 Replies
View Related
Jul 23, 2005
Hello faculties,We've a production database that is being used by one of our clientsas a backend for his website. The database size is around 1GB.Recently we added some tables to our local database which is areplica of the production database. Now we need to apply the samechanges at the production one aslo.I've no clue about what steps should i implement.Please guide me!Thanks in advanceDebian*** Sent via Developersdex http://www.developersdex.com ***
View 3 Replies
View Related
Feb 26, 2008
Hi - I'm in a situation with a very large table, and trying to run an update that, any way I've approached it so far, seems to be taking unnacceptably long to run. Table has about 20 million rows, looks something like this:
ID - int, identity
Type - varchar(50)
PurchaseNumber - varchar(50)
SalesAmount - Money
ID Type PurchaseNumber SalesAmount
1 A 3834AA38384 20.32$
2 B 3834AA38384 11837.32$
3 C 3834AA38384 666.32$
4 C 887DF88U01H 23423.32$
5 A 887DF88U01H 12.32$
6 B OI83999FH28 4747.1$
7 D 38438495985 9384.6
8 E 02939DDJJWI 22.22$
9 F 07939SDFDF2 33.33$
The goal of the update is to make the [Type] uniform across [PurchaseNumbers], according to the max sales amount. For each PurchaseNumber a, set the type = the type of the row that has the MAX salesAmount. If there is only one entry for PurchaseNumber, leave the type alone. Expected update after completion would look like this:
ID Type PurchaseNumber SalesAmount
1 B 3834AA38384 20.32$
2 B 3834AA38384 11837.32$
3 B 3834AA38384 666.32$
4 C 887DF88U01H 23423.32$
5 C 887DF88U01H 12.32$
6 B OI83999FH28 4747.1$
7 D 38438495985 9384.6
8 E 02939DDJJWI 22.22$
9 F 07939SDFDF2 33.33$
I got this out of a warehouse, and it definitely isn't normalized well. Was considering breaking down into a better model, but I'm not yet sure if that would make the update easier.
I've been approaching this with sub-queries (finding all the PurchaseNumbers with more then one entry, then the max sales purchase of that purchase Number, then the type of that purchase number and sales amount to update all of that purchase number) but this not only ends up a little messy, but also very slow.
The only other detail that may be important is that out of the 20 million total rows, about 19.5 million purchaseNumbers are unique. So, really, there are only about 500k rows I actually have to update.
I've thought of a few ways to make this work, but none of them seem fast and wanted to see if anyone had a pointer. Thanks!
View 5 Replies
View Related
Jul 23, 2005
Approximately once a month, a client of ours sends us a bunch ofcomma-delimited text files which I have to clean up and then importinto their MS SQL database. All last week, I was using a Cold Fusionscript to upload the cleaned up files and then import the records theycontained into the database, though obviously, the process tookfriggin' forever, and could have been done 500x quicker had I done itdirectly on the server. My SQL knowledge is somewhat limited, however,so I had no choice but to stick to what I know, which is Cold Fusionprogramming.In the process of cleaning up some of these comma-delimited text files,I inadvertently messed up some of the 10-digit zip codes, by applyingthe wrong Excel formula to the ZIP columns. These records were importedinto the database with obviously incorrect zip codes (ie: singledigit). So now, I have to find the best and quickest way possible tocompare these records in the database (that have the single digit zipcodes) with the unmodified data, and to update the zip codes with thecorrect data.I've had no luck setting up a TEXT file as an ODBC datasource, -- soI've ruled that out completely. I've also managed to import theunmodified data into an Access database, and to set it up as a ColdFusion datasource. But it seems this 2nd road I've been traveling downis not the ideal approach either.My question is, -- assuming that I'll be able to import the recordsfrom the Access database into their own table on the SQL server, -- howshould I go about the process of updating these records that have theincorrect zip codes?Here is the specific logic I would need to employ:* Here is a list of records, each of which contains an incorrect1-digit zip code (Database A / Table A)* Here is a much longer list of records (which contains all of therecords from Database A / Table A + thousands more), each of whichcontains a correct 5-digit zip code (Database B / Table B)* Compare both lists of records and run the following query/update:When a record in Database A / Table A has matching "name", "address1",and "address2" values as a record in Database B / Table B -- update therecord in Database B / Table B with the zip code from the matchingrecord in Database A / Table A.Would anyone care to write a sample query for me that I could rundirectly on the SQL server, or at least give me some pointers?The specific field names are as follows:name,address1,address2,city,state,zipThanks in advance!- yvan
View 5 Replies
View Related
May 26, 2015
How do I change application code to easily switch between the application working against a test database versus working with a production database?
My thought is to change the connection string to work with a test DB, and when ready to Publish, change the connection string back to the production DB. After Publish is successful, change the connection string back to the test DB.
At first, it appears it will work. Will it? Whether it will or won't?
View 3 Replies
View Related
Jul 23, 2015
I have package there i have multiple tasks,I have used one User definied varible into my package level,So here my condition is i want to change my variable name from the package level,Here that variable used in different places in my package level,it has used in some places as well in my package level.
I need to change my Variable name after development of my package so how it will changed.
View 4 Replies
View Related
Apr 15, 2015
This is on the uniqueidentifier column. Both tables are on the same database and have the same COLLATE Latin1_General_CI_AS.
But my plain update and insert results are all upper case.
Then when I tried to force by using
Insert (cols1, cols2) Values (source.col1, source.col2) COLLATE Latin1_General_CI_AS
and
Update set target.col1=source.col1, target.col2=source.col2 target.col1=source.col1 COLLATE Latin1_General_CI_AS
I got
Msg 447, Level 16, State 0, Line 32
Expression type uniqueidentifier is invalid for COLLATE clause.
View 5 Replies
View Related
Oct 10, 2006
Can I make a copy of my development database DEV on same SQL SERVER machine, rename it to TEST and stored procedures to be updated automatically for statements likeUPDATE [DEV].[dbo].[Company]SET [company_name] = @company_nameto becomeUPDATE [TEST].[dbo].[Company]SET [company_name] = @company_namein order not to edit each individual stored procedure for updating it ?
View 2 Replies
View Related
Oct 15, 2014
This statement adds two additional months to which is fine :
DATENAME(MM,dd.date)+ ' ' + DATENAME(D,dd.date) + ', ' + DATENAME(YY,dd.date)
but if my month is November and two months is added, the year does not change, it stays the same. how do I make the year change when two months are added toward the end of the year.
View 7 Replies
View Related
Mar 31, 2008
The DB Enginee is SQL2005 SP1. In MSSMS
the following query always finishes within 1 minute
SELECT *
FROM t1 INNER JOIN t2 ON t1.key= t2.key
where t1.StartTime >= '3/19/2008' AND t1.EndTime <= '3/20/2008'
AND t2.StartTime >= t1.StartTime AND t2.StartTime < t1.EndTime
however, the following always takes 10+ minutes
declare @pStartDate datetime
declare @pEndDate datetime
set @pStartDate='3/19/2008'
set @pEndDate='3/20/2008'
SELECT *
FROM t1 INNER JOIN t2 ON t1.key= t2.key
where t1.StartTime >= @pStartDate AND t1.EndTime <= @pEndDate
AND t2.StartTime >= t1.StartTime AND t2.StartTime < t1.EndTime
Both return same result. The only diff. is the blue part. Why the second one performances so badly?
Thanks.
View 4 Replies
View Related
Oct 16, 2006
It seems that the |DataDirectory| macro is giving VS 2005 fits. It's a minor issue though and I've stumbled on it recently.
The issue actually doesn't come up until you try to "add a new data source" to your project (after you've made the modification in your app settings/Project Properties to use the macro). So if you started of with ".something.sdf" and then changed it to use the macro, things do run fine....until you try to add a new datasource (new database datasource)
The error is: "Illegal characters in path" which is the pipe symbol.....
While on this subject, here's a tip to those who maybe going through some debugging mysteries:
Even if your sdf file is in your app "root" folder, if you debug, the file your app is actually working on is in the "indebug" folder. So it pays to create another connection in your Server Explorer to this file while debugging.
I spent quite some time trying to figure out why my code didn't seem to be working and got even more frustrated since obviously no errors were reported. Turns out I was looking at the wrong db file....hope this helps...
View 3 Replies
View Related
Apr 16, 2008
I have a project. Originally when I created this project, I called it "Project_A", (and I did not create a solution directory).
Doing this created a folder called "Project_A" with the following files within it. I guess these are meta data files and I shouldnt be messing around with them. Anyway, I see
(1) Package.dtsx (The default package that gets created with a new project)
(2) Project_A.database
(3) Project_A.dtproj
(4) Project_A.dtproj.user
(5) Project_A.sln
(6) Project_A.suo
When I rename my project in the Solution Explorer to "Project_B", the following happens in my folder.
Everything remains the same except Project_A.dtproj gets renamed to Project_B.dtproj and a new file called Project_B.dtproj.user gets created.
Now, my questions.
Question 1: What if I wanted my folder to have the same name as my project? Can I just change the folder name in Windows Explorer without having any ill-behaviors later on? I always have 1 project to 1 solution so I want to use the convention of keeping my folder named the same as my project.
Question 2: What about the files that are still named with Project_A dot blah blah. Is it bad if I renamed these to Project_B dot blah blah?
View 7 Replies
View Related
Sep 24, 2007
Can anyone explain why when I copy a data element and attempt to paste it it always appears waaay off screen in my SSIS 2005 package? Why won't it paste where I am right-clicking and telling it to go? I hate having to hunt for the element in the flow.
View 1 Replies
View Related
Feb 6, 2007
Hi,
I am currently creating an application that requires the use of Pocket
PC/PDA. The same application that runs on the desktop is to be run on
the mobile device metioned above. I am confused as to which of the
following combination servers i should use.
Option1)
Desktop - SQL Server Express Edition (Multi-user)
Mobile Device - SQL Sever Compact Edition
OR
Option 2)
Desktop - SQL Sever Compact Edition
Mobile Device - SQL Sever Compact Edition
To my understanding, if I use SQL Server Compact Edition on both my
desktop and mobile device, when i need to synchronise, the entire
database from the mobile device is copied over to the desktop and vice-
versa. However, I prefer only modified data to be synchornized. Can I
achieve it with the second option? Is it also possible with the first option? Please advice. Thank You
Regards,
View 1 Replies
View Related
Jan 28, 2008
I have this simple full text search query that works perfectly on my own computer using sql server 2005 express, however, on the production server(shared hosting)when I added the first 50+ rows, the full text search works perfect, but as the number of rows increases, the full text search can only see the first50+ rows, but not the new ones. Is there any quick solution for this or it's just a common mistake for developers for not properly indexed columns?Is there a way to re-indexed all rows without loosing data on the live server? search query: SELECT TOP 50 *FROM li_BookmarksWHERE FREETEXT(Keywords,@Keywords)
View 2 Replies
View Related
Aug 1, 2007
I currently have a SQL Server cluster setup with a Primary DB Server SERVER1 and the Standby server SERVER2. SERVER1 has been failing more than normal is the past few weeks and its takes upto 5 mins for SERVER2 realize that SERVER1 is down. I am looking for a better way to implement a backup server on production with minimum downtime. Please adivse..
View 1 Replies
View Related
Feb 18, 2015
Production and development servers are on different domains and they do not trust each other. How do I import data from the table t1 from a database db1 in production and load it into table t1 inside database db1 in development?
View 3 Replies
View Related
Jul 20, 2005
Any help would be greatly appreciated.My problem is that I need to set up a backup SQL Server 2000 machinewhich can be used in case of a failure to my primary. All databases(30 as of now) must be an up to the minute exact copy of productionand include most recent changes in data as well as any structurechanges (Tables, Views, SP's, Triggers, Users . . etc).When I tried this using Transactional Replication, the replicationprocess gets fouled up once I introduce any kind of structure changesto the DB. I've considered the idea of doing periodic backups andrestoring it to my backup SQL server, but this does not give me theconcurrency needed with 0 latency.I've seen articles that recommend using Transaction Replication with'Scheduled Table Refresh', and also doing database dumps to restore onthe backup machine, but I have not been able to find any documentationregarding this to try out. How can I implement this type of backupstrategy in SQL 2000?
View 2 Replies
View Related
Apr 23, 2008
I would like to deploy several reports to production server, Do i need to install reporting services entire software in order to run the reports or is it possible to just have runtime files installed on it to run the reports.
please help, i have almost 100 reports to be deployed on this server which is located in other country.
Thanks for the helpful information.
(i am using SQL server 2005 / reporting services 2005.)
View 6 Replies
View Related
Dec 7, 2001
ok ok, stop laughing. for real, is there any programatic way of doing this? whom ever created this database i inherited (SQL 2000) created the LDF and DATA files on the same drive and in the same folder for that matter. just trying to do a little disaster magament.
thanks
matt
View 1 Replies
View Related
Oct 14, 1998
This feels like a silly question, but I`m going to ask it anyway...
I have limited SQL Server experience, but have run into a wall with a client`s Web/Access combination. I need to upgrade to SQL Server. I have Beta3 installed on a development box and am very happy with it. Is anyone running this thing in a production environment? This isn`t going to be experience huge loads, so I`m tempted. Tell me if I`m crazy for wanting to try it.
View 2 Replies
View Related
Jan 31, 2007
I have a brand new database server with system databases.
I need to copy like four production database from another server to this new server. Can i do restore of the last production backups and restore them on the new server without creating the empty databases on the new server.If any one has better approach i will appreciate
View 3 Replies
View Related
Apr 4, 2008
1.First issue
The port number already allocated was 2059. We have changed that into the default port 1433 in the node. Now we are able to connect the node from the client application. But we are not able to see the configuration manager in any of the environment now.
2. 2nd issue
Cluster Environment
Error while executing the Package The connection details are not loaded in the connection manager tag
The same error with advanced information.
Another error window
R.S.Moorthy
View 1 Replies
View Related
Nov 9, 2007
I have production server 2000. The server gets disconnected sometime by itself and sometime it is working fine.Sometimes it even doesn't get restarted. Is there any problem with service packs and some performance issues.
Can you SQL guru give me best suggestion and how should i proceed.
View 3 Replies
View Related
Jan 17, 2007
Hi,I ran test data on my development machine and it took 1 minute toinsert the data. Ran the same set of data on the server and took 5minutes.Check both database and everything is the same. I even copied theproduction DB on my machine and it was taking still about 1 minute.Look at the fragmentation, and all the numbers are better on the serverthan my development machine so it should be faster.In the application I put some timer and discover that the insert istaking 0.015 ms on the server and 0 on the development. So the problemis on the insert.It is a Web application using ASP.NET.Here are the spec of the computers:Development: P4 HT 3.2GHz 1gig memory running WIN XPServer: Xeon 2.8GHz 1.5Gig memory running WIN 2000 serverAny idea how I to pinpoint the problem? I'm not at the point ofthinking that it can be the hardware, but how to verify that?ThanksFrank
View 2 Replies
View Related
Jul 12, 2007
Hi,
Presently our Organisation is in process of Implementing SOX.
Under Compliance all the User have to be removed from the Production Server.
1.My Question is Do a DBA Should have Admin Privilages on the Production Server.
If yes then what are the Actitvies that a DBA has to perform only if DBA have admin privilages.
Regards
Sufian
View 2 Replies
View Related
Nov 6, 2007
Like most enterprise there is the database administrator (dba) and there are the developers(dev). The dba are conservative while the developers are also exploring their options.
One of the current usage I'm experimenting on is to provide data visualization - image for the data. Like most I needed to "create" the System.Drawing assembly in the database, marking it unsafe.
During my testing, my code had some exception and that brought down SQL Server.
I read that the CLR is better compare to the sp_OAs as well as the extended stored procedures written in C++ because it isolates the execution in a separate app domain and termination is clean - in case of any errors, it should not bring down SQL Server.
Also I read marking assembly unsafe void these benefits of isolation.
Instead of having to manage the situation where it involves code review by the dba and asking the dba to take some risk, is there a technique where all CLR code that runs in the production server does not pose stability issues.
View 1 Replies
View Related
May 27, 2007
How can I apply SP2 on running production server if SP resets all protocols (from TCP/IP enabled on production server to Shared Memory enabled) without disrupting its connections and thereafter its work?
View 1 Replies
View Related
Feb 2, 1999
hi, I have total 45 GB of data in the following servers ( 40 GB in sql server 6.5, 5GB in ftp server). both servers are in one machine(server). I want to make sure that I am doing the right thing for backup. The machine is not connected to a Lan. What is the best way to insure that my data are backed up safely?
what I am thinking of doing is to back up the database to using sql tools in the menu bar, that will backup the data to the same machine in this directory:
c:mssqlackupDBname.DAT
I will do this for all database in the sql server. Am I save to do this... I am wondering what IF the machine in which both severs are in crashed. My backup effort will be lost too. right. so what is the best way to protect my data. Do I need to buy a tape backup so I can do what I am doing Plus back up the c:mssqlackupDBname.DAT to the tape backup... I would really appreciate any suggestion in choosing any media (software/ hardware)to back up my data.
Thanks
Ali
View 4 Replies
View Related
Aug 20, 2004
I'm looking to purchase new server hardware that will host my corporate intranet and a sql server instance. In most cases I can't see this server being hit by more than 20 or 30 users but I want it to be quick. I'm planning on running Server 2003 with sql server 2k and the intranet on IIS.
What I'm not sure about is the single vs dual processor and the RAM. How valuable is the dual proc? And the RAM, I plan on 1.5 GB but I wonder what the benefits are beyond that.
Perhaps with this many users it doesn't make that much difference but I can see adding more load.
Does anyone have any recommendations?
View 3 Replies
View Related
Mar 31, 2008
I've got a situation where I need to regularly (maybe each month), detach a DB, copy its files from their highspeed SAN location to a slower NAS, then re-attach it and make it available on-line. We're doing this for our DB's as they age to > 3 years.
Just wondering if any of you have scripts you can point me to so I don't have to re-invent the wheel.
Also, after you re-attach, how do you verify the NAS DB is 100% ok before deleting the original from its SAN location?
Any help/advice is appreciated.
Thanks,
Isaac
View 9 Replies
View Related
Aug 23, 2007
Hi
We currently have a Server:
Dual Intel Xeon 3.0 GHz
4 GB ram
(C) 2x18 GB SCSI disks RAID 1 for OS
(D) 4x72 GB SCSI disks RAID 5 for Data
The server is running:
Windows 2003 + IIS (Single web application)
Tomcat (Single web application) (Is about to be outfased)
MS SQL 2005 (In simple recovery mode)
The C-driver is currently only used for OS and applications
The D-driver is holding all data + SQL Data files and SQL Transaction files...
E.g.
- SQL Data files = 7 GB
- SQL Transaction files = 20 GB
- Image liberary = 100 GB
- Other = 15 GB
The IIS uses around 768 MB ram for cashing and execution of the web application
The Tomcat uses around 350 MB ram
The SQL is the to use a max of 2.2 GB ram (and 1024 MB pr. query)
(Leaving around 512 MB ram left)
There is only one database installed on the SQL, but it is very large (+15 mill records)
We are currently doing Free-Text searches in one table (~3.5 mill records), and it is to slow.
So the question is what is the best way to gain performance...
- Increase to 8 GB ram?
- Purchase a new server as webserver, so the curr. server can be dedicated as SQL?
- Attach a NAS to split the SQL files into several groups, and seperate transaction logs from data?
(6 disks are max in curr. server)
Economy has to be considered :)
Thanx!
View 7 Replies
View Related