DB Design :: Can Field Be Moved Within Same Table?

Nov 19, 2015

I have a table named [Customers] which has about 100 fields and tens of thousands of records. These fields have been created over a couple years, but now they are so disorganized its getting crazy. I want to move the fields using click and drag on the record selectors the GUI in design view of SQL Server Management Studio, but I am worried about possible dangers. Is there anything I should be worried about by doing this before saving the changes? I don't want to make a view because the front end program is pretty big and would require way too much reprogramming to point all its parts to a new view on a table used so much already.

The question arises because when I try, it wants to also save all tables that are FKs to this table, which are many(and have cascade updates on). So I decided to abort and get info I should know first. Although the data shouldn't change when moving the field, I don't want to just assume that nothing will go wrong.

Also, the system is live, and it isn't easy to shut down to do this change. Is it essential that the system be offline, or at least has no users connected to the tables?

View 3 Replies


ADVERTISEMENT

SQL Table, Key, Field Design

Dec 5, 2007

i am putting together an application for a client of mine that involves image heavy data handling. i have a couple of possible methods in mind of how to go about this, and would like some outside opinions, especially from any of you who may have done anything similar before.
to quickly sum up the application's desired results: a photo gallery that contains four sections of job before/after photos. 1)residential 2)comercial 3) automotive and 4)specialty.  when a site browser clicks a section, it will bring up a gridview of the "key" or ideal photo (one each)from several different jobs. the site browser can then click the photo, and a new page (or new control, does'nt make much difference) will come up showing all photos for that particular job.)  past and current customers will create user logins to have ability to upload photos of their specific job. admin needs ability to 1)upload photos for many jobs 2)review all photos before posting them to the gallery 3) would like to give admin ability to order the photos within the gallery and within each job 4)admin needs ability to create tagline with short description either for each photo or at least for each job.
as to the design of the data, i can either store the images themselves in the database, or create tables to tag the images with various identifying data, then simple store and call the images in a directory on the server.  i have code to do either.  i am trying to construct a database design to handle all issues.  i like the idea of storing photos in the database more, just not sure how to architect it.  it would be the 4 albums, each with infinitely create-able 'job' albums within, each job album housing job photos.
i am thinking the images maybe get a table for their specific info (ID as primary key, image itself, file type, length, and a foriegn key to a job table that has jobID primary key) the job table could have a job name that user inputs, thus identifying all photos to the same job.  the job table would also foriegn key to the album table id, with its four categories of residential, automotive, commercial, and specialty.  does this method seem feasible? if this system seems workable, i can throw in a boolean default to false for the admin to set true to display the job photos as a whole, with admin power to delete photos on an individual basis.  but i am a little stumped how he can maybe order them?  maybe an int field that he can edit and just manually put the jobs in the order he wants? and then put the photos under the jobs in the order he wants as well?
it seems i have somewhat thought this out just now while writing, so it seems i have a somewhat workable solution, if awkward, but if anybody knows a simpler, or tried and true, method, please let me know
any ideas, suggestions, and help is greatly appreciated.

View 23 Replies View Related

DB Design :: Define Automatic Sequence On A Table Primary Key Field?

Jun 13, 2015

I am designing a database. I want to define a automatic sequence  on a table primary key field. what is the best solution for it?

I know I can enable identity property for a field, but  it has some problems ( for example its seed jumps on restart and unsuccessful events)

I also can use some calculated sequences. for example I can calculate max of the filed values and after incrementing use it as key for new inserted record.

which one is better?

View 3 Replies View Related

Moved Stock Minus In Item Table To Stock In Itemmoment Table

Sep 11, 2007

 helo all...,i want to make procedure like:examplei have table: item (itemid,itemname,stock)orderdetail(no_order,itemid,quantity)itemmoment(itemid,itemname,stock)item table itemid    itemname    stock  c1        coconut         2  p1         peanut          2orderdetail tableno_order        itemid        quantity   1                  c1                5itemmoment tableitemid    itemname    stock  c1       coconut          0  p1       peanut            0 when customer paid, his quantity in orderdetail decrease stock in item table..so stock in item table became:itemid        itemname    stock  c1            coconut         -3  p1            peanut           2it's not good, because stock may not minus...so i want to move -3 to itemmoment table..so stock in item table became:itemid        itemname    stock  c1            coconut          0  p1            peanut           2and in itemmoment table became:itemid        itemname    stock  c1             coconut        3  p1             peanut          0my store procedure like:ALTER PROCEDURE [dbo].[orders](    @no_order as integer,    @itemid AS varchar(50),    @quantity AS INT)ASBEGIN    BEGIN TRANSACTION            DECLARE @currentStock AS INT                SET @currentStock = (SELECT [Stok] FROM [item] WHERE [itemid] = @itemid)        UPDATE [item]        SET            [Stock] = @currentStock - @quantity        WHERE            [itemid] = @itemid    COMMIT TRANSACTIONENDit's only decrease stock with quantity. i want move stock minus from item to itemmoment..can anyone add code to my store procedure?plss.. helpp.thxx....

View 2 Replies View Related

DBCC SHRINKFILE: Page 4:11283400 Could Not Be Moved Because It Is A Work Table Page.

Jul 20, 2007



Hi,



I issued this command on Tempdb but it doesnot shrink the file.



dbcc shrinkfile (tempdev_3,1)

go



Messages:

-----------------------------------------------------------------------------------------------------------

DBCC SHRINKFILE: Page 4:11283400 could not be moved because it is a work table page.

-----------------------------------------------------------------------------------------------------------------------------------------------



I have checked that there are no tables associated with any user in tempdb. Any help is appreciated.



Regards,

Razi

View 15 Replies View Related

TSQL - Copy Table As New Table And Get The Sum Of Specific Field Group By Other Field

Sep 4, 2007

Hi guys,
I need to get a column with the sum of the field "SUF" from table "JurnalTransMoves_1" when that field ("SUF") is ordered by the field "REFERENCE" from table "Stock", and Show the value only once.

The desired result should by something like:








Stock.REFERENCE
JurnalTransMoves.SUF
SUM(JurnalTransMoves.SUF) Group By Stock.REFERENCE

5752
10
60

5752
20


5752
30


5753
400
3000

5753
500


5753
600


5753
700


5753
800


5754
7
15

5754
8



Is there any chance to do that?
Thanks in advance,
Aldo.




Code Snippet
SELECT
Accounts.FULLNAME AS 'ACCOUNTS.FULLNAME',
Accounts.ACCOUNTKEY AS 'ACCOUNTS.ACCOUNTKEY',
Accounts.FILTER AS 'ACCOUNTS.FILTER',
Accounts.SORTGROUP AS 'ACCOUNTS.SORTGROUP',
AccSortNames.SORTCODENAME AS 'AccSortNames.SORTCODENAME',
Accounts.CreditTermsCode AS 'Accounts.CreditTermsCode',
CreditTerms.DETAILS AS 'CreditTerms.DETAILS'
CreditTerms.CURRENF AS 'CreditTerms.CURRENF'
CreditTerms.MONTH AS 'CreditTerms.MONTH',
CreditTerms.DAYS AS 'CreditTerms.DAYS',
CreditTerms.SHAREPRC AS 'CreditTerms.SHAREPRC',
CreditTerms.TEMF AS 'CreditTerms.TEMF',

CASE
WHEN CAST(Accounts.VatExampt AS int) = 0 THEN 'x'
WHEN CAST(Accounts.VatExampt AS int) = 1 THEN 'y'
ELSE 'Undefined' END AS 'VAT',

Stock.DOCUMENTID AS 'Stock.DOCUMENTID',
DocumentsDef.DOCNAME As 'DocumentsDef.DOCNAME',

CASE
WHEN CAST(Stock.DOCUMENTID as int) = 1 THEN Stock.DOCNUMBER
WHEN CAST(Stock.DOCUMENTID as int) = 3 THEN Stock.DOCNUMBER
WHEN CAST(Stock.DOCUMENTID as int) = 35 THEN Stock.DOCNUMBER
WHEN CAST(Stock.DOCUMENTID as int) = 120 THEN Stock.DOCNUMBER
WHEN CAST(Stock.DOCUMENTID as int) = 31 THEN Stock.REFERENCE
WHEN CAST(Stock.DOCUMENTID as int) = 44 THEN Stock.REFERENCE
WHEN CAST(Stock.DOCUMENTID as int) = 34 THEN Stock.REFERENCE
WHEN CAST(Stock.DOCUMENTID as int) = 43 THEN Stock.REFERENCE
WHEN CAST(Stock.DOCUMENTID as int) = 40 THEN Stock.REFERENCE
ELSE '' END AS 'Invoice No',

Stock.VALUEDATE AS 'Stock.VALUEDATE',
JurnalTrans.DESCRIPTION AS 'JurnalTrans.DESCRIPTION',
JurnalTrans.REF2 AS 'JurnalTrans.REF2',
JurnalTransMoves.SUF AS 'JurnalTransMoves.SUF',
JurnalTransMoves_1.SUF AS 'JurnalTransMoves_1.SUF',
JurnalTransMoves.TRANSID AS 'JURNALTRANSMOVES.TRANSID'

FROM
JURNALTRANSMOVES AS JurnalTransMoves_1
INNER JOIN JURNALTRANSMOVES AS JurnalTransMoves
INNER JOIN (SELECT DISTINCT JURNALTRANSID, RECEIPTSTOCKID, FULLMATCH, TABLFNUM, CKCODE, RSORT, RUSEFID FROM RECEIPTJURNALMATCH) AS ReceiptJurnalMatch_1 ON ReceiptJurnalMatch_1.JURNALTRANSID = JurnalTransMoves.ID
INNER JOIN ACCOUNTS AS Accounts ON JurnalTransMoves.ACCOUNTKEY = Accounts.ACCOUNTKEY
INNER JOIN JURNALTRANS AS JurnalTrans ON JurnalTransMoves.TRANSID = JurnalTrans.TRANSID
INNER JOIN STOCK AS Stock ON JurnalTrans.STOCKID = Stock.ID ON JurnalTransMoves_1.TRANSID = JurnalTrans.TRANSID AND JurnalTransMoves_1.ACCOUNTKEY = Accounts.ACCOUNTKEY
LEFT OUTER JOIN ITEMS AS Items
INNER JOIN STOCKMOVES ON Items.ITEMKEY = STOCKMOVES.ITEMKEY
INNER JOIN ITEMSORTNAMES AS ItemSortNames ON Items.SORTGROUP = ItemSortNames.ITEMSORTCODE ON Stock.ID = STOCKMOVES.STOCKID
LEFT OUTER JOIN ACCSORTNAMES AS AccSortNames ON Accounts.SORTGROUP = AccSortNames.ACCSORTCODE
LEFT OUTER JOIN CREDITTERMS AS CreditTerms ON Accounts.CREDITTERMSCODE = CreditTerms.CREDITTERMSCODE
LEFT OUTER JOIN DOCUMENTSDEF AS DocumentsDef ON Stock.DOCUMENTID = DocumentsDef.DOCUMENTID

WHERE
Accounts.SORTGROUP Between '3001' And '3020'
AND Accounts.ACCOUNTKEY IN ('123456')

ORDER BY Accounts.ACCOUNTKEY

View 22 Replies View Related

DB Design :: Table Design For Packages

Aug 18, 2015

I would like to create a table called product. My objective is to get list of packages available for each product in data grid view column while selecting each product. Each product may have different packages type (eg:- Nos, CTN, OTR etc). Some product may have two packages and some for 3 packages etc. Quantity in each packages also may be differ ( for eg:- for some CTN may contain 12 nos or in other case 8 nos etc). Prices for each packages also will be different that also need to show.  How to design the table.. 

Product name   :  
Nestle milk |
Rainbow milk
packages  :
CTN,OTR, NOs |

CTN, NOs
Price:
50,20,5 |
40,6

(Remarks for your reference):CTN=10nos, OTR=4 nos  
| CTN=8 Nos

View 3 Replies View Related

Database Design For Status Field

Mar 1, 2007

Hello,
I have a database design question. I want to store a status in a table. In the ASP.NET interface for the user this status will be adapted to the language of the user.
This is how it would look like:
StatusID 1 = "yes" for English, "oui" for French, "ja" for DutchStatusID 2 = "no" for English, "non" for French, "neen" for DutchStatusID 3 = "error" for English, "erreur" for French, "fout" for Dutch
I don't want to do the translation in ASP.NET and it should be done in one query.
How would it look like in the database design.

View 5 Replies View Related

Design Question: Calculated Field

Jul 20, 2005

I'm trying to create an OLAP system using SQL Server 2000 AnalysisServices (AS). I want the AS cube to be based on a database with astar schema.I have a field called Ratio. The initial ratio value is based uponthis formula: (CurrentTimePeriodAmount -PreviousTimePeriodAmount)/PreviousTimePeriodAmount. However, thatinitial ratio can be manually overridden and replaced. Then the ratiois used to calculate future Amounts.Should I place that calculated Ratio field in the "source" databasedesign or should it be part of the Analysis Services cube?

View 2 Replies View Related

DB Design :: How To Format Bit Data Type For Gender Field

Jun 23, 2013

I'm designing a database that stores personal details of students and teachers for a school. I, wish to know if a there is away of formatting the bit data type to male/female. Cause i am only able to achieve 0 and 1 in this data type. So is there any way to change it, or is there any other data type suitable to provide only two options Also the database should be protected in a way that students may not be able to view or change. Only teachers/admin have the right to access/modify the data.

View 6 Replies View Related

DB Design :: Foreign Key Referencing Non Unique Field In Server

Oct 12, 2012

I ran into an interesting situation.  I'm working on contract and was looking at creating an ERD for an existing database when I ran into a problem.  I found FK's that are referencing columns that do not have a unique constraint or a unique index. 

I don't know the history of the database but was there a time in SQL Server history where this would have been possible?  I scripted out the tables and created it in a test database.  When I run the script to create the FK I get the following message. 

I double checked the original tables and this FK does exist in table1 and there is no unique anything in the referenced table, table2.  Currently the database is running on SQL Server 2008 Ent.

ALTER TABLE [dbo].[table1] WITH CHECK ADD CONSTRAINT [FK_table1] FOREIGN KEY([Col1])
REFERENCES [dbo].[table2] ([col2])

There are no primary or candidate keys in the referenced table 'dbo.table2' that match the referencing column list in the foreign key 'FK_table1'.

View 4 Replies View Related

Updating Fact Table Field From Source Table Field

Apr 11, 2008




Hi,


I have source table , fact table and four dim. tables , I have to update a field in fact table from source table.

How can I do it?

thanks...

View 6 Replies View Related

T_Log Moved!!! Please Help

Feb 5, 2001

Hi!
I hope anyone can help me out. Our Transaction Log file
of our PUBLISHED Database has unfortunately been moved to
a differant folder. After that a new one has been created.
After movin back the old one, the DB isn't accessible from
the clients anymore. (ODBC error message)
How can I get that old log file back to work???
Is it possible to use sp_detach and sp_attach on a replicated
database?

Please help me with that urgent problem!
Thanx in advance
Gert

View 1 Replies View Related

Sql Box Moved From One Place To Other

Jan 5, 2006

what happens if the physical location of a box(which had sql server 2000 on it) is chaned.
what happens to the replication and distributed queries.
Thanks.

View 1 Replies View Related

Help On Updating A Field In A Table With The Field Content Of Another Table

Jun 25, 2007

HI everybody need help on this..

I have two tables below

table1

country countryid

africa ___
usa ___
italy ___
Spain ___

table2

countryid country name

1 africa
2 germany
3 italy
4 usa


I need to write the countryid of table 2 to the field countryid in table1 using the criteria of the correspoinding country name table 2 to country of table 1 if it write countryid else 0..

THE RESULT WOULD BE

country countryid

africa 1
usa 4
italy 3
spain 0

thanks

View 7 Replies View Related

Selecting Field From Second Table If Same Field In First Table Is Null

Nov 25, 2007



Hi,
I have one table (PermProportionalCosting) that contains employeecode, costcentre and proportionpercentage. An employee may have two or more records in this table, indicating that their salary has been split across multiple costcentres.

Another table (Employee) contains a default costcentre for each employee.

Another table (TransActualHistoricalMaster) contains the hours paid to each employee for each pay period.

My query so far selects all employees and the total hours worked from the TransMaster table, and then selects the costcentre and proportionpercentage from the PermProportionalCosting table. Multiple lines are created for all employees in the PermProportionalCosting table, with each line indicating the proportionpercentage and associated costcentre.

This is my query so far:

SELECT TransActualHistoricalMaster.EmployeeCode, Employee.PreferredName, Employee.LastName, CostCentre.Description, PermanentProportionalCosting.CostCentreCode,PermanentProportionalCosting.PercentageSplit,
TransActualHistoricalMaster.OrdHours
FROM TransActualHistoricalMaster
INNER JOIN Employee ON TransActualHistoricalMaster.EmployeeCode = Employee.EmployeeCode
INNER JOIN CostCentre ON Employee.CostCentreCode = CostCentre.CostCentreCode
FULL OUTER JOIN PermanentProportionalCosting ON TransActualHistoricalMaster.EmployeeCode = PermanentProportionalCosting.EmployeeCode
GROUP BY TransActualHistoricalMaster.EmployeeCode, Employee.PreferredName, Employee.LastName, CostCentre.Description, PermanentProportionalCosting.CostCentreCode, PermanentProportionalCosting.PercentageSplit, TransActualHistoricalMaster.OrdHours

This next bit is what I am unsure of.

I would like the CostCentre field from the Employee table to go into the PermanentProportionalCosting.CostCentreCode column where the employee doesn't have a record in the PermanentProportionalCosting table. In the above query, there is a null value for each employee that doesn't have a record in the PermanentProportionalCosting table, so I would like my query to replace the null value with the costcentre from the Employee table.

Any assistance would really be appreciated.

Thanks.

View 3 Replies View Related

How Do ITables Moved To A New FileGroup ?

Jul 23, 2005

I have a SQL Server 2000 database and want to now split up the tablesonto seperate file groups as well as some indices.How do you breakup an existing table to move it from one filegroup(Primary) to the new filegroup ?Thanks.Craig

View 4 Replies View Related

Moved From Ms Sql 2000 To Ms Sql2005

Aug 3, 2006

database has been recently upgraded from ms sql 2000 to ms sql 2005.are there anything I need to be aware after upgrading to ms sql 2005?for my experience, i got an error if i use column alias in ORDER BYclause which was fine on ms sql 200.thanks

View 1 Replies View Related

Help With DDL Trigger. Moved From Other Newsgroup.

Mar 26, 2008

I haven't gotten a response yet, so I moved this from another group. Ihave been working on this for 2 days so if anyone has any ideas, Iwould be grateful.I have a 3rd party program that creates and populates tables in mySQLServer 2005 database.The program fails on the inserts on "tblB" because the field itcreates is too small for the data that it is trying to put in it(stupid).I wrote a DDL trigger that attempts to alter the table as soon as itcreated, allowing all the data to be loaded.However, something about this trigger causes a prior table "tblA" tofail.Here is the error message that I get on inserting into tblA with thetrigger for tblB in place:Execution of this SQL statement failed: Create table tblA(STATUSCHAR(1) NOT NULL DEFAULT'', SCHOOLNUM[Microsoft][ODBC SQL Server Driver][SQL Server]SELECT failed becausethe following SET options have incorrect settings:'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'. Verify thatSET options are correct for use with indexed views and/or indexes o(yes, it truncates the error message)My trigger is basically:USE [IGPLINK]GO/****** Object: DdlTrigger [NO_SOUP_FOR_YOU] Script Date:03/24/2008 16:04:42 ******/SET ARITHABORT ONGOSET CONCAT_NULL_YIELDS_NULL ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_NULLS ONGOSET ANSI_PADDING ONGOSET ANSI_WARNINGS ONGOSET NUMERIC_ROUNDABORT OFFGOCREATE TRIGGER [NO_SOUP_FOR_YOU] ON DATABASEFOR CREATE_TABLEASSET NOCOUNT ONDECLARE @xmlEventData XML,@tableName VARCHAR(50)SET @xmlEventData = eventdata()SET @tableName = CONVERT(VARCHAR(25), @xmlEventData.query('data(/EVENT_INSTANCE/ObjectName)'))IF @tableName ='tblB'BEGINALTER TABLE dbo.tblB ALTER COLUMN STULINK Numeric(16,0)ENDHowever, when I have enterprise manager script my trigger, it looksaltered. I think these ON/OFF settings at the end are screwing thingsup. Any suggestions?USE [IGPLINK]GO/****** Object: DdlTrigger [NO_SOUP_FOR_YOU] Script Date:03/25/2008 11:10:05 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TRIGGER [NO_SOUP_FOR_YOU] ON DATABASEFOR CREATE_TABLEASSET NOCOUNT ONDECLARE @xmlEventData XML,@tableName VARCHAR(50)SET @xmlEventData = eventdata()SET @tableName = CONVERT(VARCHAR(25), @xmlEventData.query('data(/EVENT_INSTANCE/ObjectName)'))IF @tableName ='tblB'BEGINALTER TABLE dbo.tblB ALTER COLUMN STULINK Numeric(16,0)ENDGOSET ANSI_NULLS OFFGOSET QUOTED_IDENTIFIER OFFGOENABLE TRIGGER [NO_SOUP_FOR_YOU] ON DATABASE

View 7 Replies View Related

Moved Asp.net App To Network Share, Can't Access SQL

Jan 19, 2007

I've recently moved an asp.net website from my PC to a network share because another tech it going to be working on it.  I finally got the correct permissions on the network share and the correct .NET Framework settings on my PC to be able to run the app.  Now I can't access the SQL server which is on a different server.  Getting the following error:
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
How to I setup access to my SQL server for the app from any given PC on my LAN?
 

View 1 Replies View Related

How To Define Field Attribute For A Numeric Field In SQL Table?

Jan 19, 2005

I need create a field to store tax rate. I need only 2 decimal points. I defined the field as decimal, precision=5 and scale=2. Does it mean that it can hold value from 0.00 to 999.99?

View 12 Replies View Related

DB Design :: Insert / Update FACT Table From Staging Table

May 6, 2015

We need to Insert/Update a Fact Table from staging Table. currently we are using a SP which update Fact Table for Each region.  this process is schedule,  every 5 min job is run and Update fact table.but time of Insert and Update too long from  staging  to Fact, currently we are using merge statement for Insert and update.in my sp we are looping number  how many region we need to update and at a time single Region we are updating using while loop in current SP.

View 7 Replies View Related

DB Design :: Table Partitioning Using Reference Table Data Column

Oct 7, 2015

I have a requirement of table partitioning. we have 10 years of data on a table which is 30 billion up rows on 2005 server we are upgrading it to 2014. we have to keep 7 years of data. there is no keys on table or date column. since its a huge amount of data and many users its slow down the process speed. we are thinking to do partition on 7 years for Quarterly based. but as i said there is no date column on table we have to use reference table to get date. is there a way i can do the partitioning with out adding date column on table? also does partition will make query faster? 

I have think three ways to do it.
1. leave as it is.
2. 7 years partition on one server
3. 3 years partition on server1 and 4 years partition on server2 (for 4 years is snapshot better?)

View 3 Replies View Related

Can Aspnetdb.mdf Be Moved From Development To Production Machine?

May 2, 2007

1.) Can an aspnetdb.mdf database be configured and setup on one server and then be moved to a production server or is there something machine specific that keeps this from being possible?  2.) Is putting this file in the app_data folder something that is used only for SQL 2005 or SQL express?  I had to set up a connection string in my SQL 2000 installation to get the connection to work.
Thanks for any input!
Colelaus

View 4 Replies View Related

Need Help - Database Has Been Moved To SQL Server 2000 From SQL Servere 6.5

May 20, 2005

Hi there,
    I am not sure if this is the right place to seek help for the problem i have but as i don't see any other link to discuss the situation i have i am just posting it here.  To explain a little bit about the project i am on..... Originally the  appication(developed in asp.net and vb) i am assigned to was developed by a different team and most of the databases  were on  SQL server 6.5 servers. So they have used oledb connections where ever they had to connect SQL server 6.5 data sources. Lately the client has moved all of the sql server 6.5 data bases to SQL server 2000 and now the application is kinda not working as it is suppose to as it was before. So i am hired to fix the problem.
So as a first step what i am doing is finding out all of the .net oledb proivder part of the database connections code to SQL server 6.5 data sources and changing them to .NET provider for SQL server.
Say for example in the below GetConnection function i am commenting out OledbConnection and defining a SqlConnection instead.
Private Function GetConnection() As IDbConnection
'Dim conn As IDbConnection = New System.Data.OleDb.OleDbConnection
Dim conn As IDbConnection = New System.Data.SqlClient.SqlConnection
conn.ConnectionString = Helpers.DBHelpers.GetConnectionString(Helpers.DBHelpers.COMMON)
Return conn
End Function
and also commenting out OledbDataAdapter line of code and defining a SqlDataAdapter instead. You can see it below
'Dim adapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(CType(cmd, OleDb.OleDbCommand))
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(CType(cmd, SqlClient.SqlCommand))
And connection strings are defined in web.config file and also i am changing those as well . See below.
 
<!--<add key="Common" value="User ID=Test;pwd=*****;Data Source=ESMALLDB2K;Initial Catalog=cj_common;Auto Translate=True;Persist Security Info=False;Provider=&quot;SQLOLEDB.1&quot;;" />-->
<add key="Common" value="User ID=Test;pwd=*****;Data Source=ESMALLDB2K;Initial Catalog=cj_common;" />
So i hope i am in the right direction as far as the first step. But please throw in any kind of suggestions on this.
 
One more thing. I have a search screen and T-sql query thats built for this purpose searches 4,5 tables and brings the data back.
When i make a search from the web browser it doesn't return the data for the first couple of times but it brings the data 3rd time but even its taking as long as 60 seconds to bring the data back.  when i close the browser and debug and paste the SQL query in the query analyzer it returns the data in the query analyzer and when i complete the remaining part of debugging and bind the data to the gird i also see the data on the broswer for the first time itself.
Question : Why i don't get the data for the first time when i search it from the front(web browser)?
But like i said the executing time to the query in the query analyzer itself takes considerably long time( i would say around 60 seconds just to return 3,4 records)) in the query analyzer. When i talked to the database guys why sql queries are a little slow they say they have a lot of datat out there around 180 thousand records in it and thats why its taking that much time to search agains all of the rows.
Question - Do you think it could be some thing to do with dropping and recreating the indexes should solve our problem? May be its some thing to do with the indexes but i am sure they have not dropped out the indexes of all of the table objects and recreated yet after the databases are moved to SQL servere 2000.
Hope i am able to explaing what i am looking for and what i am doing.
Please help me understand in solving these problems. Thanks in advance
-D

View 1 Replies View Related

Stored Procedure Referencing Moved Tables

Mar 12, 2001

Hi everyone

I am totally confused, please help me. I am new to this

I am trying to split one DB (A) into two databases original (A) and new-Blank(B) by moving some tables from DB (A) to the new DB (B) however some of the tables has FK and Stored procedures referencing other tables that need to stay in DB (B), The questions are

1. after scritping these tables while they are in DB (A), and runing the script in DB (B) to re-create them, do I delete these table from DB (A), and the FK that references them.

2. What shall I do with the stored procedures. Turn them into trigers or else if turn them into trigers, in which DB should the triggers run (DB A of DB B),if these are becoming triggers do I delete the stored procedures from DB (A)

Any reply is appreciated

View 2 Replies View Related

Moved Report To Another Solution, Now Parm Won't Work

Apr 25, 2008



Hi all,
I moved a report to a different solution using the "Add Existing Item" function. Verified that all the data sources were properly connected and that my queries to provide parameter lists were running ok. When I try to run the main data source (a stored proc) from the data tab, I get this message:

"..An error occurred while executing the query.
Procedure or function 'ReportSP' expects parameter '@Item, which was not supplied.
(Microsoft SQL Server, Error: 201)"

This SP runs fine from the old solution and in Management Studio, so there must be something I need to do in the new report. Can anyone point me in the right direction?
I checked the report parameters and it's there. When I try to preview the report, it lets me pick all the parameters, including the one it's griping about, then it throws the message.

Any help would be appreciated - Thanks!


View 1 Replies View Related

Moved Sql Served Db Is Missing Tables -- Master Db Issue?

Jan 10, 2002

I recently moved the db to a new server using detach and reattach sproc. However the moved db in its new location does not have any of the tables or sprocs that I created. As I understand it, information on the databases on the server is stored in the master db. Could it be that the tables are not showing up because the master db on the new server knows nothing of the new db? Must I also copy the master from the other server, perhaps? Has anybody come across this before? TIA D. Lewis

View 2 Replies View Related

SQL 2012 :: Moved Backups To Fileshare But Can't Restore Directly

Oct 29, 2014

We had our backups backing up to the server where the databases reside. Now I modified the backups to backup to a file share. Now when we try to restore from the file share the restore fails, so we have to copy the backup to a drive on the server and recover for there. Should I be able to restore directly from the file share (using the gui)? Do I need to change something else to modify the default backup drive?

View 9 Replies View Related

Adding A New Field To A Table With Image Field

Aug 24, 2006

Hi,
I have a concern about adding a new field to a table with image field - which is huge.
Will there be a problem with some databases, where they have a hard time locating data correctly after such a large field?
Previously this happened to me, and what was advised to put all the big fields at the end of the table.
Thanks.
 

View 1 Replies View Related

Adding In A Whole Dataset Into A Table - Instead Of Field By Field

Feb 29, 2008



does anyone know if there is a way, or perhaps a custom toolbox control that is already developed that allows you to drag an entire dataset into a table, instead of pulling everything in field by field...?

was just curious.

-dk

View 3 Replies View Related

Moving From One Table To Other Table Automatically For Every 3 Months By Checking The Paticular Value Of The Table Field

Mar 29, 2007

Hi
 
I am having a table called as status ,in that table one field is there i.e. currentstatus.
the rows which are having currentstatus as "ticket closed",i want to move those rows into  other table called repository which is having same table structure as status table.
I can do programatically.
but is there any way for every 3 months system has to check and do this action means moving to repository table automatically?
 
Please help me.
 
Thanks.

View 1 Replies View Related

DB Design :: Insert Data From One Table To Another Table

Jul 30, 2015

I have to tables like given below Landing table "A" (Data load will happen over here, No primary keys mentioned over here) table "B" .Now I want to move the data from A to B.I have made use of below query insert into B select * from A...Landing table "A" has huge no of records, MS SQL server is taking huge amount of time.any alternative way to make this insertion process faster?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved