We have an environment/application where we have separate databases for different clients. Each database is pretty much a copy of the other - i.e. same tables, same stored procs, and a few reference tables whose data content is the same across all the dbs - except for that client's data in the user tables.
The issue we have is one of maintenance and growth. We wanted separated DBs so the amount of data in one would not result in performance issues for another client among other things (security and geographical separation for example). However, now that we are adding more clients the deployment team has to apply changes (schema chagnes, stored proc modifications) to each and every database. Does SQL (2005 SP2 in our case) support a concept of shared resources like schema, stored procs, user functions, and even a few tables but separate out the data for other tables? That way the schema, reference data changes have to done in one place...
I'm kind of new to sql server (but experienced in Oracle) and I've got a couple of questions I wanted to bounce off you guys.
I'm implementing a SQL server cluster right now (2 node on Win2K3, shared EMC DASD for databases). We're at the very preliminary phase of this. I did an install and had my resource group set up with all of my disks on it. When prompted for the data file drive, I gave it one, but it put all the tlogs for the 'out of the box' database on that same drive as the data files (i.e. master, model, tempdb, etc.). The doc is a little vague in some of these areas (i.e. it says separate logs and data files on different disks, but then never actually tells you how to do that).
Now, I know how to specify the default paths for data and transaction logs for any NEW database I create and that's not a problem. However, my question is, how do I 'move' the tlogs from the databases created during the install? I've tried a detach, move tlog to separate physical drive and then reattach the db, but whenever I do this, SQL server wants to create a new tlog for the db on the same old drive as the datafile. I also can't delete the original tlog from a particular database even after I've created an additional tlog on another disk.
Any help is much appreciated. I'm more or less looking for the strategy any of you might take to set up this initial phase.
I just want to verify my understanding of schemas...
Using separate schemas to segregate data is only a logical mechanism. Separate schemas do not physically segregate data onto different groups of pages or files. Partitioning is the mechanism for physical segregation of data.
Do we have provision of separating sa and sso role in SQL server as we have in sybase? ( In such a case, sa shouldn't have any control on creating/modifying users/logins)
The all caps text strings at the beginning of the field need to end up in a separate field than the mixed strings, and the mixed strings need to stay together. The field length varies, as do the lengths of the all caps text strings. There are a lot of records, so I would be interested to know if there was a way to proceed without manually editing each line.
I have a client who is in the market for a dedicated SQL box. It's a smaller company of 50 users. The primary task of this machine is a backend for Sharepoint 2007. At first I'm stuck using MSSQL 2000 for a few months until the budget can be approved to upgrade them to 2005.
I intend to spec this machine out for 2005, the question I have at the moment pertains to the HD configurations.
How would you recommend rigging that up?
Mirror for system, Mirror for the data store, mirror for transaction/temp files?
Put everything on a Raid-5 and forget about it?
I also have a question about Quad Core processors. How does MS sql's licensing work on that?
I guess I just don't get the reasoning behind the new SqlDataSource control. Haven't we just spent the last decade or so evangelizing and learning how and why to separate business logic from the display in VB 6 and VS.NET? In this age of programming for disparate devices (desktop, mobile, PocketPC, etc.) when this separation makes more sense than ever, why is MS pushing us to go back to putting our logic and data access rules and objects back in the display? It doesn't make sense. Why would anyone do this? And why would all the experts and MVPs at ASP.NET, DevX, 4GuysFromRolla, etc., go along with this?
We have a system that uses 3 databases, one for Membership db standard MS membership only the application has access to that data, one with User Data which we would like to make multi-tenant using Schema-Separation, and a third read-only reference db which is Common Market data for all users.we anticipate Tenant numbers in the thousands.Current we have multiple queries which create joins between the Main db and the Reference database using something like
Selec S.*, M.ScheduleDate, M.substation from Sites S left outer join Market.dbo.MarketUnit M where S.MarketUnitID = M.MarketUnitID
i'm planning to have a new schema for each Tenant on the Main Database, so I would create a Schema T1 for the first customer, a user T1User with access to T1 schema. and grant T1User access to Market.dbo. My First question is are there any concerns about the above T1User setup? My second question is, are there any tools which would automate the setup of the multi-tenant with schema separation, or should I just script the whole Main Database schema creation and replace schema name globally and then execute the script?
My Third question, how about upgrade and updates... currently using VS to compare dev/qa/prod database to identify changed which need to be promoted, and pushing updates... this could be a big pain to promote code to thousands of Schemas. grantedwe will likely keep the overall number of schemas spread over different SQL servers.
I am getting ErrorCode 8 while loading the data from stage to model. I have checked my error view it states that "Member Code is Inactive".
Initially I have loaded same set of data in Model from MDS Stage table but then deleted with ImportType = 5 which removed all the data from the MDM model.
Now i want to load it back but its giving the Error Code 8 .. Before loading the same data i have changed the stage table Importtype to 2 and Importstatusid to 0.
I've searched everywhere. I have 3 textboxs, a calendar, and 2 time controls successfully connected to an SQL Express database via a TableAdapter. The default VB code keeps updating to the first line of the db. I want it to start a new row in the db when I save the data. What VB express code/command does this? I can't use the save button, I need to use code. Thanks.
Does anyone have code to access data? I want to create a sqldatasource control on the page, but would like to programmatically/manually/code-behind-wise to fill in my queries and their parameters. Thanks!
I have a sqldatasource in the markup. This is in turn connected to a Gridview. I use Eval to retrieve the database information in the markup but I also need the Eval information in code behind. How can I do this? I got this far but how (if it's possible this way) can I retrive it? Protected Sub Test(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If (e.Row.RowType = DataControlRowType.DataRow) Then this is where i want to get the "MyData" value from the database. End If ........
Simple question, I hope. How do I pass a dataset out of Report Designer to custom code when the dataset is not from the table's parent dataset?
In other words, we have a table who's dataset is dataSet1. I want to perform some calcs on dataSet2 which are not doable in the report table cells, so I want to pass it out to a code block. I just can't figure out how to get a whole field out from a secondary dataset.
=Code.MyCode(Fields!name.Value)
works fine to pass something from dataSet1. However,
=Code.MyCode(Fields!name.Value, "dataSet2")
won't work because the scope has to be wrapped in an aggregate. But in an aggregate I won't get the full 'name' dataset, only one value from it. Is there another way to specify the dataset that a field is coming from other than an aggregate scope?
How does one perform this tricky bit of getting the values out to the code?
Background: I am a post-graduate student developing a model of the way HIV/AIDS spreads in communities. The data sets I am using are large (eg census data - 50m records) and the manipulation is complex (eg deciding which individuals will begin a sexual partnership, and with whom).
Problem: I need to process a table of data in code written in C# that will insert the results which are also a table of data into a table in the database.
In the example set up below, a table with rows comprising an Integer and a Real is the input. The output is a table where each row also comprises an Integer and a Real. Each row of input, say (Inti, Reali) leads to Inti rows of output. The example below gives a simple example of this.
The T-SQL code below sets up the problem, and includes simplest possible T-SQL that would lead to the requisite Output, so that you could compare your solution's code's with it:
-- Set up tables to use in example
CREATE TABLE InputTable
(
Int1 INT NOT NULL,
Real1 REAL NOT NULL
)
GO
CREATE TABLE OutputTable
(
Int1 INT NOT NULL,
Real1 REAL NOT NULL
)
GO
--Initialise the Input Table
INSERT INTO InputTable (Int1, Real1) VALUES (3, 0.5)
INSERT INTO InputTable (Int1, Real1) VALUES (5, 0.99)
--Manually put Data into Output table
--I do know how to code this in T-SQL using cursors and loops
--I wish to code this part in CLR
INSERT INTO OutputTable (Int1, Real1) VALUES (1, 0.5)
INSERT INTO OutputTable (Int1, Real1) VALUES (2, 0.5)
INSERT INTO OutputTable (Int1, Real1) VALUES (3, 0.5)
INSERT INTO OutputTable (Int1, Real1) VALUES (1, 0.99)
INSERT INTO OutputTable (Int1, Real1) VALUES (2, 0.99)
INSERT INTO OutputTable (Int1, Real1) VALUES (3, 0.99)
INSERT INTO OutputTable (Int1, Real1) VALUES (4, 0.99)
INSERT INTO OutputTable (Int1, Real1) VALUES (5, 0.99)
--This should show the output
SELECT * FROM InputTable
SELECT * FROM OutputTable
--The output should be
Int1Real1
3 0.5
5 0.99
Int1Real1
1 0.5
2 0.5
3 0.5
1 0.99
2 0.99
3 0.99
4 0.99
5 0.99
Additional Information: I would be grateful if your solution could indicate
* whether the code to be written is a class, stored procedure or user-defined function
* the answer could be included in entirity begining with "using system..."
* example T-SQL that can be used to execute the code
Current knowledge:I can write T-Sql. I have written C# user defined functions and stored procedures, assembled them and run them from within SQL-Server 2005.
Hello All,i have a sql database with a table as follows. CustID (PK, Varchar(50) not null )Address ( VarChar(max), null)City ( VarChar(max), null)State( VarChar(max), null)Zip ( VarChar(5), null) ----------------------------- this is not working cuts off the leading zero like ( 01234) is shown as 1234DateShipped( datetime, null) --------------------- this display 05/18/2008 12:00AM. i just want to display (05/18/08).how can we do the above two. any suggestions please. i tried smalldatetime no luck . i appreciate it.Thanks.
How do I access sqldatasource data values in code behind and bind them to strings or texboxes etc. as oposed to using Eval in the markup? I can create a new database connection, but I would like to use the data values from the autogenerated sqldatasource control Many thanks,
First of all let me say that ASP.NET a new programming environment for me so please forgive my ignorance. Can someone please tell me how to write data to a SQL table that is a Binary data type? I have a stored procedure on the SQL server that I am calling to insert data into a table. I build a parameter list and set the values. It worked just fine before I added a binary field to the SQL table. My problem is that I don't know how to set the Binay data type to pass it to the stored procedure. Here is part of the code: GetCMD = Myconnection.CreateCommand GetCMD.CommandType = CommandType.StoredProcedure GetCMD.CommandText = "SCHEMANAME.InsertLineItem" GetCMD.Parameters.Add("HEADER_ID", SqlDbType.VarChar, 150) GetCMD.Parameters("HEADER_ID").Value = "some value" GetCMD.Parameters.Add("@OPTIONS", SqlDbType.Binary) GetCMD.Parameters("@OPTIONS").Value = HOW DO I SET THIS VALUE???? rowsaffected = GetCMD.ExecuteNonQuery() I assume serialization but have not figured out how. Anyone's help is greatly appreciated!!
I wrote code to archive Data.I created a table that set the maximum number of records to archive and delete and loop until finished or a set a flag in a table to stop archiving. I was able to limit the number of records to commit.
In the SQL Server Technical Article Microsoft .NET Data Provider for mySAP„¢ Business Suite
is a Code example of how to invoke a BAPI in .Net Code. First line shows how to create a Connection to SAP, but there is no information in which lib the SAPConnection type is stored:
SAPConnection con = new SAPConnection("ASHOST=<SAPserver>; CLIENT=<client>;SYSNR=<sysnr>;USER=<user>;PASSWD=<password>;LANG=<logon language>"); con.Open();Does somebody can help me?
I encountered this error while running a data flow:
OnError,,,Data Flow,,,10/14/2007 2:00:57 AM,10/14/2007 2:00:57 AM,-1073450974,0x,SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Business Unit Lookup 1" (26410) failed with error code 0xC004702C. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
I'm using OLEDB Source, Lookup, SQL Destination in the data flow.
I tried running the package again and it worked fine this time.
I want to publish my web site and sql server on a hosted server. But i'm worried about people behind the server. all of my codes including web and stored procedures of sql server are open. as far as I know, there is no effective way to protect web pages source. how about sql server? I mean compiling stored procedures.
and another important thing is data. I think certain people have potential to see or change all of my records, or for example give email address of my customers to a third party or ... .
Hi, there; I try to import data from ODBC using C# programmatically. Is there any sample code we can have a look. Like how to read schema from ODBC source table and then create source column...
I have tried the upsize wizard from access 2000 and access 2003 and get records transfer in 90% of the tables I have data stored an 89 meg MS access database (2003) on an XP machine. I can use, compact and copy etc in MS Access without problem.
With the upsize, I get No errors, just does not reliably move ALL data. I have run it multiple times and occasionally get some data in these tables, but never all data in a few tables and inconsistent.
========================================
So I have written code to copy the data from the access database and move it field by field into an Upsized database that was structure only, no data.
I have ONLY one Identity field (autonumber in MS access) that is the Key Relationship number to all other tables.
1 questions and one "bug" report need solutions to both.
Question: How can I copy the value from the MS access autonumber field to the identity field. (Some of the autonumber rows have been deleted so not always sequentiall) (I can do this moving data in code between to MS access databases that have autonumber fields)
=========================
I tied an elaborate write around to addNEW and then read the data in the newly created row. Reading the Identity field, I look up that number in the MS access database. Then I copy the ACCESS data to the Newly created table row in SQL Exress and update.
It works fine for about 30 record updates, then the Identify field stops giving me the correct sequence for the Identity field value. Makes it impossible to make sure all of my Access rows get copied. Tried transactions but not supported with the ADODB configuration, but doubt that would help.
Example data returned in the SQL Express recordset, when I read the Identify field back I get
1,2,3 etc 31, 33, 32 (out of sequence) then it (my code) can't figure out the out of sequence and end up with the next identity value at 41.
The only info I found was that it could be a cursorlocation problem, what do you recommend?
?Is there a way in code to change the identity field to string, then copy the data and change back to identity field again?
Hi, i'm new to reporting services, rather new to heavy processing in reporting services. i have scenario for which i need your help. so here it goes,
i have a method in Code area of the report, i'm passing parameter values to it. the method willl return me a swl query in string format. i need to execute it in data tab area. the codei have used in data tab is as below. please let me know. wat to do to make it right. thx
EXEC ('Code.Main(Parameters!Param1)' + UNION + 'Code.Main(Parameters!Param2) ' + UNION ALL + 'Code.Main(Parameters!Param3)')
Thx again
i need to get this report done really soon, so please, if u have any idea let me know ASAP
Yesterday, in response to an error msg (something like Login failed for user ''), I deleted the 'providerName=System.Data.SqlClient'in my connectionStrings from Web.config. Then the aspx website worked.I understand that the value "System.Data.SqlClient" specifies that ASP.NET should use the ADO.NET provider System.Data.SqlClient when making a connection. Why deleting providerName solved the error? Jeffrey
I am in the position where I have to transfer data from an old database schema to a new database schema. During the transfer process alot of logic has to be performed so that the old data gets inserted into the new tables and are efficiently done so that all foreign keys are remained and newly created keys (as the new schema is Normalised alot more) are correct.
Is it best if I perform all this logic in a Stored Procedure or in C# code (where the queries will also be run)?
I have statement which is comparing a smalldatetime column to literal string as follows:
sales_date ='21-9-2004 0:0:0.000'
when I run the statement in query analyzer it bombs out with:
Server: Msg 296, Level 16, State 3, Line 1 The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
If I alter the format of the date literal to '2004-09-21 00:00:00' the statement works.
Is there anyway of forcing the statement to treat '21-9-2004 0:0:0.000' as '2004-09-21 00:00:00' without modifying the statement itself ?
Dear list,I am trying to get the names of the tables and the column names from thecode below for a database but it is not working. When I run the querybelow the column titles are delivered but there is no data. I think thismight be a premissions issue. Has anyone run into this before?Thanks in advance.Use Test_db/* Provides Table Name, Column Name, Extened Description */Select a.name as tbl_name, b.name as column_name, d.name as data_type,d.length as length, d.xprec as prec, d.scale as scale, b.usertype,b.scale, c.valuefrom sysobjects as a inner join syscolumns as b on a.id=b.id inner joinsysproperties as c on b.colid=c.smallid and a.id=c.idinner join systypes as d on b.xtype=d.xtype
SSIS seems to automatically set the metadata type and for "typed" sources like database and XML connections it seems to take whatever the source column datatype is. If you use a cast or convert in the your source SQL query, it will not change the datatype of the metadata. This becomes an issue when doing things like merge joins on data from different sources and the join columns are different types (e.g. a ZipCode in one system is a varchar and it is an int in another system). I've been working around the issue by editing the XML code and changing the datatype there. Is there any way to do this through the GUI?