Now the question is that an organization and a person both need to access the address table.
Is it better to have a PersonsAddress table and an OrganizationsAddress table, or is it better to have some sort of AddressAccess table that the persons and the organizations tables both relate to and have some sort of type field in there that specifies Org or Person?
Hello, I am trying to configure a Script Component as a data source. Although this should be a simple exercise, I am running into a problem.
My control flow contains a Foreach Loop with a file iterator. The Directory Expression of the Foreach Loop Editor is supplied by an expression mapped to a package level variable called inputdirectory. The FileNameRetrieval Expression is mapped to a package scoped variable called filename.
My data flow is encapsulated by the Foreach Loop, and contains a Script Component as Source for the Data Flow Source, and a Flat File for the Data Flow Destination. The contents of the Script Designer are as follows:
Code Block Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper Imports Microsoft.SqlServer.Dts.Runtime.Wrapper Imports System.IO Public Class ScriptMain
Inherits UserComponent Dim thisFileDate As Date Dim thisFileName As String Dim thisFilePath As String Public Overrides Sub CreateNewOutputRows()
thisFileName = ReadOnlyVariables("filename").Value.ToString() thisFilePath = ReadOnlyVariables("inputdirectory").Value.ToString() thisFileDate = File.GetCreationTime(thisFilePath & "" & thisFileName) FileSpecBuffer.AddRow() FileSpecBuffer.FileName = thisFileName FileSpecBuffer.FullPath = thisFilePath & "" & thisFileName FileSpecBuffer.CreateDate = thisFileDate End Sub End Class
When I debug the package, I get the following error:
The collection of variables locked for read access is not available at this point.
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.get_ReadOnlyVariables()
at ScriptComponent_67311120e6eb4162a3ea1f70847f04de.ScriptMain.CreateNewOutputRows()
at ScriptComponent_67311120e6eb4162a3ea1f70847f04de.UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
My googlefu fails me at reconciling this. I have read various posts about changing the line ReadOnlyVariables("filename").Value to ReadWriteVariables("filename").Value, and handling the buffer assignment in PostExecute. The problem is that all examples shown are either for Script Component as Destination or Script Component as Transformation. I have tried playing with the Custom Properties in the Script Commponent set the ReadOnlyVariables and ReadWriteVariables, using a PreExecute method, a PostExecute method, all with different errors returning. I'm at a loss here. Could anybody provide me with a simple working example so that I can correctly populate my output buffer in the context of Script Component as Source?
I fully understand that I could just run a Script Task Using System.IO.Directory, and System.IO.File, but I really want to make this package work in the manner I've described. Any help would be appreciated.
First off, I appreciate the time that those of you reading and responding to this request are offering. My quesiton is a theoretical and hopefully simple one, and yet I have been unable to find an answer to it on other searches or sources.
Here's the situation. I am working with SQL Server 2005 on a Windows Server 2003 machine. I have a series of databases, all of which are in Full recovery mode, using a backup device for the full database backups and a separate device for the log backups. The full backups are run every four days during non-business hours. The log backups are run every half hour.
Last week, one of my coworkers found that some rarely-used data was unavailable, and wanted to restore a database to a point in time where the data was available. He told me that point in time was some time back in November.
To accomplish this, I restored the database (in a separate database, as to not overwrite my production database) using the Point in Time Recovery option. I selected November from the "To a point in time" window (I should note that this window is always grey, never white like most active windows, it seems), and the full database backup and the subsequent logs all became available in the "Select the backup sets to restore" window.
I then tried a bevy of different options from the "Options" screen. However, every restore succeeds (ie: it doesn't error out), but seems to be bringing the database back to a current point in time. It's never actually going back to the point in time I specify.
My questions are as follows:
a) Is it possible to do a point in time recovery to a point in time BEFORE the last full database backup?
b) If so, what options would you recommend I use? (ie: "Overwrite the existing database", restore with recovery, etc etc).
I again appreciate any and all advice I receive, and I look forward to hearing from anyone and everyone on this topic. Thank you.
I am trying to make changes to the above query. This query will select 2 records per Company with top down priority on JobLevel. For example: This query will select 2 records from "123 Inc", where they have 2 Managers and 3 Staff contacts. The return results selects (2) managers and no staff records and FirstName and LastName are not duplicate. Then for "A Small Co.", they have 1 VP, 1 Director, 1 Manager and 3 Staff contacts. the return results chooses 1 VP and 1 Director and no managers or staff level people. And so on and so forth for the remainder of the companies.
What I was trying to accomplish is having this same query point to the database tables instead creating a table each and every time. I have this data residing in our database. I tried to make the change so it would point to the database tables but it kept giving me errors. This is way more complex than I thought.
My failed attempt:
Select * From CampServ.dbo.SampleFakeCustomerData //This is where I am getting stuck WITH Priorities(Priority, JobLevel) AS( SELECT 1, 'VP' UNION ALL SELECT 2, 'Director' UNION ALL
I'm writing a classic ASP application that records all logging of userlogins on our support site. The logging is a rolling window of how manypeople have logged in for a given month, i.e. tracked by a 'lastlogin'field so the tracking is done in a date range. So, for the month ofJanuary I would record lastlogin dates between January 1 and January31. My question is this...on the last day of the month (example beingJanauary)at 23:59:59PM I want to write the total number of users thathad a lastlogin date within the month of January and write that totalnumber to another table so I have a point-in-time figure for Januarylogins and how many users logged in in the month of January. How do Ido that? How can I have the sql server dynamically check the last dayof each month at 23:59:59PM and then run that query to obtain the totalnumbers users that logged in and then record that value to anothertable?? Do I use a SQL Job to do that?Any help would be greatly appreciated! Thanks!
If I perform a truncate table (non-logged operation) in my application, will this preclude me from being able to do a partial recovery (point-in-time) of my app. using the transaction logs?
While cleaning up some code, I ran across the following statement in a stored proc - the purpose of which is to determine if a table exists in the local database: SELECT * FROM dbo.sysobjects where id = object_id(N'[dbo].[XML_PRINTDATE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1of course I removed it from the IF just for testing purposes, but my quandry is this... Why chose that select (converting table name to object ID) rather than just doing THIS:SELECT * FROM dbo.sysobjects where name = N'XML_PRINTDATE' and OBJECTPROPERTY(id, N'IsUserTable') = 1
I first thought it was to gain access to the "id" column value (and that may yet be the purpose of it), but the second code seems to work just peachy (I assume because the id column is present in the sysobjects table itself).
A follow-on question is this: When I try to do the same check from another server (i.e.SELECT * FROM APRECEIVE1.DailyProd.dbo.sysobjects where name = N'XML_PRINTDATE' and OBJECTPROPERTY(id, N'IsUserTable') = 1) it of course fails because OBJECTPROPERTY only looks for the id on the local database.
So, do I CARE if it is a user table? (I am reasonably sure it is, of course) and if so, is there a way to check on the remote server for the object type?
Bottom line is I Think I can just simplify things and check for the object name on the remote server, but just don't want to take away any "warm fuzzy feeling" generated by the original stored proc, if such a warm fuzzy is of any benefit (though don't get me started on the relativity of warm fuzzies, I wrote my Thesis on that ;) )
I'm running SQL Server 2005 on a Server 2003 machine serving both our home network as well as a remote site through a point-to-point T1. While file transfer speeds are up to par, the remote site's interaction with SQL Server (Point of sale system) is very slow. After testing I am certain that it has nothing to do with the actual physical machine in place neither is it an issue with the program itself since speeds are as they are supposed to be over the home network lan. It seems that there might be a packet size issue or something of the sort. Has anyone dealt with this before or have any thoughts?
create a new Connection Manager by right-clicking in the Connection Managers section of the design area of the screen. Select New OLE DB Connection to bring up the Configure OLE DB Connection Manager dialog box. Click New to open the Connection Manager. In the Provider drop-down list, choose the Microsoft Jet 4.0 OLE DB Provider and click OK. Browse to the Access database file and connection set up---all good!!!
Dataflow task Add an OLE DB Source component Double-click the icon to open the OLE DB Source Editor. Set the OLE DB Connection Manager property to the Connection Manager that I created . Select Table from the Data Access Mode drop-down list. I cannot see the tables set up as set up as pass-through table types to a Oracle 9i db
I have set up a link from ACCESS to a SQL 7.0 database using ODBC (File DSN saved on a shared DRIVE). The link works well only from the workstation where the link was created. But How can I create a link so a group of users can view the linked table in ACCESS without type a password? Any suggestion is appreciated.
Hopefully I am posting this question in the correct forum. I am still learning about SQL 2005. Here is my issue. I have an access db that I archive weekly into and SQL server table. I have used the dst wizard to create an import job and initally that worked fine. field I have as the primary key in the access db cannot be the primary key in the sql table since I archive weekly and that primary key field will be imported several time over. I overcame this initally by not having a primary key in the sql table. This table is strictly for reference. However, now I need to setup a unique field for each of the records in the sql table. What I have done so far is create a recordID field in the sql table that is an int and set as yes to Identify (auotnumber). That worked great and created unique id for all existing records. The problem now is on the import. When I try to import the access table i am getting an error because of the extra field in the sql table, and the error is saying cannot import null value into this field. So... my final question is how can I import the access table into the sql table with one extra field which is the autonumber unique field? Thanks a bunch for any asistance.
Strange one here - I am posting this in both SQL Server and Access forums
Access is telling me it can't append any of the records due to a key violation.
The query:
INSERT INTO dbo_Colors ( NameColorID, Application, Red, Green, Blue ) SELECT Colors_Access.NameColorID, Colors_Access.Application, Colors_Access.Red, Colors_Access.Green, Colors_Access.Blue FROM Colors_Access;
Colors_Access is linked from another MDB and dbo_Colors is linked from SQL Server 2000.
There are no indexes or foreign contraints on the SQL table. I have no relationships on the dbo_ table in my MDB. The query works if I append to another Access table. The datatypes all match between the two tables though the dbo_ tables has two additional fields not refrenced in the query.
I can manually append the records using cut and paste with no problems.
hi all, is there any query to move certain data from a sql data to access table through query. i am having a requirement where i have to fetch the records from a sql table that falls within a specified range to a ms access table. is this possible through a query.
Question is: I have table1 in first db and I would like to access this table in second db. In oracle, we create db links to achieve the same. How do we achieve the same in SQL Sever?
Another question about SQL Server tables and access grants.I've created an user 'user1' as Access account, ad also as db_owner of aselected database.Then, I've created a table as user1.table1.When I try to access the data of the table, with the account name of user1,I must specify the owner ('select * from user1.table1') even if I've loggedas user1 (I need to access the data just with 'select * from table1').What's the problem?Thank youFederica
I have a database like DemoData . It contains some tables?
I want to allow the updations and editions for the fields of table1 in DemoData into Outlook calendar.
My process is..... 1. I want to access the Outlook2003 Calendar fields like Subject,Location,StartTime ,EndTime and Contacts and Categories etc and to place them with the DemoData table1 fields using C# windows Application. Letus assume the Table1 contains the columns as.. Subject,Address,Stime,Etime, Contact and Cate
2. same as the above question i want to access the Tasks in Outlook2003 with another table fields.
so if we want to work like this what we have to do?
I have some junk tables in my database, but I am not sure if they are really not in use. Does sql server log the last time that a table gets accessed? when I say access I mean any actions toward the table, including select, update, insert, etc.thanks in advance.
Hi All, I have to to do SQL Query a table which is placed in different server than my current SQLServer.Please guide me to perform this task. Thanx,Karthik.A
Hi: I have a UDF that splits a string based on a delimiter.The UDF returns a table of records:1- ID2- ValueThe string I am sending to split is:'2-4-07:00 AM-08:30 AM'I am splitting on '-'What I get back is a table of 4 rows.I want to get each value, convert it to the right data type, then assign it to its own variable.How can I get each row alone manually? Can I? Without using Cursors?if I do a "select * from Split(@myData,'-')", then I cannot retrieve each field alone,Thank you.
My problem is that I can't query a couple of tables. I created them using DTS myself, in a db called contracts, and called one of them 010425. I've logged in as SA, and making sure the correct DB is shown in Query Analyser.
Here's the query...and very simple it is;
SELECT TOP 10 * FROM [dbo].[010425]
I just keep getting the following error message;
Server: Msg 208, Level 16, State 1, Line 1 Invalid object name 'dbo.010425'.
But it shows up in Sysobjects and EM!
I can query the system tables, using EXACTLY the same syntax...no problem there.
I've got SQL Server 7 running on W98. Everything is happening locally.
Hi all, I'm writing a procedure that require to access a table from a different database but from the same server. Can the procedure able to read this table. If so how should my procedure use that table? Thank you for all your help.
I have an access application that gets used by people on the road. They put data into a local table and occasionally log into our network and transfer a file to a temp table in SQL.
I've created a linked table to Access. I want to be able to delete records and modify existing records through this linked table. I used the account with sa privelleges yet i am unable to delete/update any records.
Does anyone know if there is any fix or am i doing anything wrong ?
Is there a way of INSERTing INTO an Access table using T-SQL? Here's an Access query that I need to do in SQL Server:
INSERT INTO tblCreditMemos IN '\NW-ITD-FS2ilcas$AccessAutomated Budget ReportingABRBackEnd.mdb' SELECT * FROM billc_cred03f_temp; Any help appreciated.
I'm using ODBC to link a SQL table to access and using Access as the frontend, so to speak. Trying to write a query, but I get Timeout Error. I need to resolve the timeout error, I've tried several things in the ODBC configuration, but no solution yet. thx jm
hi, i am using stored procedure which put data in another table fron different database.
so i am using servername.databasename.dbo.tablename.
if I am change the servername then i have to edit the Stored procedure. Is there any way to access server name.so that if server name is chane then also i dont have to change stored procedure.
Like in c we use #define where we change value of variable that is reflected in whole program.
Hi, I have 2 databases in SQL Server named Database1 and Database2. I have logged in Database1. I would like to see the records of the Table which is present in Database2. Could anyone please tell me How to access the tables in Database2 from Database1?
Lets say i have 2 servers in my Computer. Local server and a common server (network) and i want to copy a table from common server to my local server . How to do that?.
I want to import an Access table into a SQL table. Some of the integer Access fields have a null value, but when they are imported I want them to be 0 or zero in my SQL table. How can I do this please ?
Morning/Afternoon Hello all, Have little question to ask; well that's the world’s biggest bluff. I'm currently looking after a highly used database, but i know that it is full of tables that are not being used (Need deleting) as it’s taking up so much space that can be freed up; basically these tables have been left behind by developers. I did go ahead and think about just randomly deleting them but then i thought that some of these might still be used. So here's the question is there a way that when a table is access as in an update, select, delete that i can record it in a table along with the date it was accessed (and even what type of access it was I know this is pushing it) and then query that table at a later date so i can tell what are the true tables being access and then hopefully go ahead and delete the correct ones and not make a fool of myself. Any help or ideas on this would be a great help for me. I am still quite new Sql Server. Hope you can help