How Do I Change Sp_server_info Attribute Called Accessible_Tables?
Oct 18, 2007
I am attempting to change the schema of a table in my database. My intent was to put the table in the new schema, restore all the appropriate permissions, then create a synonym with the original schema and table name that will point to the table in the new schema.
This appears to work fine for most of our applications that access this table, except for one. We have a PowerBuilder application, which I know nothing about, that cannot access the table through the synonym. After running Profiler, I found that the application is calling sp_tables to make sure that the table exists prior to inserting into it. Since the server attribute Accessible_Tables is set to its default value of Y, synonyms are not returned. Since sp_tables does not find the synonym, the application believes the table does not exist and raises an error stating this.
It looks like sp_tables will return synonyms if I can change the value of Accessible_Tables to N. Could somebody confirm that this is true? Also, how can I change this attribute? I cannot find any documentation on how to change any of the attributes returned by sp_server_info.
Not that it matters, but I am running SQL 2005 Standard 9.0.3161 64 bit.
I have 2 dimensions that pull their Facility Name from the same Location Dimension. The business users want to change Facility Name in the Material Facilities dimension to “Material Facility Name”, but keep Facilities dimension attribute the same. What is a good way to go about completing this task.
I've selected a domain-based attribute for one of the leaf member attributes in the same entity, aka parent id, since it's a self-referencing entity. However, I cannot find a way to display anything but the code value in the drop-down (see below).
Is there a way to change the display value so that I can choose the attribute from the entity from which I want the user to choose? In other words, I would like to display the hierarchy name instead of the code, which is really just the primary id.
I had to change the key columns of a dimension attribute to fix an error. I did this in BIDS. The change was from a single key column to a composite key column. Now I am getting these error when I process the cube:
Measure group attribute key column x does not match source attribute ..
I looked at the cube XMLA definition under mesaure groups and it still shows a single key column with inherited binding. However, the BIDS does not give me an option correct this in any way. I have had to do this once before and the only option seems to be removing the dimension from the cube and add it back in. But that is very error prone since I lose any specific settings at the cube dimension level not to mention aggregations no longer include the dimension, etc.
Not seeing an alternative, I went through each measure group (I have 7) and changed the key columns manually in the XMLA and saved the cube. This worked, but I don't understand why BIDS automatically doesn't do it.
Is this a flaw in the BIDS or I should be missing something.
How can I execute or access a web page from a DTS package?
Both SQL server AND website are hosted on the same server (a Dual 2.4Gz Xeon with 2Gb RAM, RAID 5 etc)
I have 2 tables in SQL server 2000 that hold orders. These need to be posted into another table at a predefined time (ie: 4:30pm) and at the same time, access a remote address (a web service) and post certain elements of the order back.
Basically, can anyone help me out on how to execute a web page from a DTS.
I do NOT want to access a DTS from a webpage, which is all I'm finding at the moment.
Hello, Question is, when I try to create relationships in SQL 7 without using the wizard..upon adding the tables I get an errror message that says "Coinitialization has not been called". What does this mean?
I'm stumped on what to cal this, there might even be a method or pattern named for what i am trying to accomplish...
In the database, a number field is included on each table
When the DAL reads the record from the database, it is passed to the client - work is possibly done to the record and is sent back to the DAL for update.
A query is done against the table to retrieve the record again, the numbers are compared - if they don't match, it is assumed the record been modified by another user/thread/activity. An error is returned to the client stating the data has been changed.
if the numbers match, the record is updated with the number field being incremented by one.
what is this methodology called (beside crap :-) )
Hello, perhaps you guys have heard this before in the past, but here iswhat I'm looking for.I have a SQL 2000 table with Social security numbers. We need tocreate a Member ID using the Member's real SSN but since we are notallowed to use the exact SSN, we need to add 1 to each number in theSSN. That way, the new SSN would be the new Member ID.For example:if the real SSN is: 340-53-7098 the MemberID would be 451-64-8109.Sounds simply enough, but I can't seem to get it straight.I need this number to be created using a query, as this query is areport's record source.Again, any help would be appreciated it.
This seems like a basic question but I have not been able to find the answer in the help files or by searching this forum.
Is a trigger called for each row updated or is it called once for all rows updated?
for example if I have:
Code Snippet CREATE TRIGGER mytrigger
ON mytable AFTER UPDATE AS BEGIN
EXEC e-mail-me inserted, N'mytrigger', getdate() END
and I do this
Code Snippet UPDATE mytable SET mycolumn = N'whatever' WHERE ID > 5 AND ID <= 10
Assuming there is a record for each nteger value of ID, than will mytrigger run 5 times (once for each row updated) or one time (with inserted containing all 5 rows)?
When a column is evaluated against an UDF in a SELECT ... or WHERE ... It makes sense that the UDF is called for every row of the SELECT. But is it still true if the UDF is called in a subquery as below?
Code Snippet
SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus()) I've made a test and the SQL Profiler Trace shows that the UDF is called only once.
Can anyone confirm if my test is valid and most importantly that the UDF is called only once? FYI, I never use sub queries. This is to clarify a technical detail for our performance investigation.
Thank in advance for any help.
Here is the code to setup the test: USE NorthWind GO
CREATE TABLE dbo.UdfTest ( LineID int Identity(1,1) NOT NULL, AnyText varchar(200) COLLATE database_default NOT NULL ) GO
CREATE FUNCTION dbo.F_Bogus ( ) RETURNS @tab TABLE ( LineID int NOT NULL, AnyText varchar(100) COLLATE database_default NOT NULL) AS BEGIN INSERT @tab (LineID, AnyText) VALUES (1, 'UDF1') INSERT @tab (LineID, AnyText) VALUES (2, 'UDF2') INSERT @tab (LineID, AnyText) VALUES (3, 'UDF3') INSERT @tab (LineID, AnyText) VALUES (4, 'UDF4') INSERT @tab (LineID, AnyText) VALUES (5, 'UDF4')
RETURN END GO
Here is the capture of SQL Profiler when executing the statement: SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus())
SQL:BatchStarting SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus()) 51 2008-05-06 17:58:31.543 SQLtmtStarting SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus()) 51 2008-05-06 17:58:31.543 SPtarting SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus()) 51 2008-05-06 17:58:31.577 SPtmtCompleted -- F_Bogus INSERT @tab (LineID, AnyText) VALUES (1, 'UDF1') 51 2008-05-06 17:58:31.577 SPtmtCompleted -- F_Bogus INSERT @tab (LineID, AnyText) VALUES (2, 'UDF2') 51 2008-05-06 17:58:31.577 SPtmtCompleted -- F_Bogus INSERT @tab (LineID, AnyText) VALUES (3, 'UDF3') 51 2008-05-06 17:58:31.577 SPtmtCompleted -- F_Bogus INSERT @tab (LineID, AnyText) VALUES (4, 'UDF4') 51 2008-05-06 17:58:31.577 SPtmtCompleted -- F_Bogus INSERT @tab (LineID, AnyText) VALUES (5, 'UDF4') 51 2008-05-06 17:58:31.577 SPtmtCompleted -- F_Bogus RETURN 51 2008-05-06 17:58:31.577 SQLtmtCompleted SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus()) 51 2008-05-06 17:58:31.543 SQL:BatchCompleted SELECT LineID, AnyText FROM dbo.UdfTest WHERE LineID IN (SELECT LineID FROM dbo.F_Bogus()) 51 2008-05-06 17:58:31.543
I have some nightly jobs that execute stored procedure to call the tables? I want to know which table are called by these stored procedures. Is it possible? Any idea will be appreciated.
I am encountering an issue which is effecting our production environment, none of our sql jobs are now saving any kind of job history, nor are the status of the jobs being saved. I have run a profiler trace and it seems as if procedure : sp_sqlagent_log_jobhistory is not being called during the execution of any of our jobs Has anyone else encountered anything similar?
In a stored procedure the following code snippet 1 checks against duplicate data being inserted. I've tested it with snippet 2 and it works as expected. However, when the procedure is called from ASP.NET the check seems ineffective. I still get the error msg. The application uses a SqlDataSource with the following parameters.
Any suggestions?
Thanks,
Bakis.
PS I want to ask a question on the ASP.NET forum .The login/pwd for this forum "get me in" to the .net forum in the sense that when I log in I see a logout link. I don't get an "ask a question" button though. Is there a separate screening for each forum?
<UpdateParameters>
<asp:Parameter Name="CatItemUID" Type="Int32" />
<asp:Parameter Name="CatName" Type="String" />
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quad" Type="Int16" />
<asp:Parameter Name="UID" Type="Int64" />
</UpdateParameters>
snippet 1 :
if (@CatItemComboExists > 0 ) BEGIN --print @CatItemComboExists return 0 END
snippet 2:
begin tran declare @return_status int EXECUTE @return_status = spUpdateCatItemRec 343, 'blah','blih', 2,3 print @return_status rollback
error msg only if proc is called from app
Violation of UNIQUE KEY constraint 'IX_tblCatItemUID'. Cannot insert duplicate key in object 'tblCatItemUID'.
I am maintaining some C# and ASP.NET code with SQL server 2000. My code calls a stored procedure. The code is a little confusing as to the name of the SQL Server stored procedure that is calling. At this point I don't know how to trace into or debug the stored procedure. Kind of hard to do in the first place when you are not absolutely certain as to the stored proc to be called.I can take an educated guess as to which stored procedure is being called. I figure if I can deliberately make a certain stored procedure fail then this might be able to somehow give me the name of the stored proc that I am calling.So is there a way to do this. Namely make a stored procedure fail, or to return the name of the stored Proc?I would sincerely appreciate some help with this problem.
Im using a SqlDataSource control. Ive got my "selectcommand" set to the procedure name, the "selectcommandtype" set to "storedprocedure"What am i doing wrong ? Ive got a Sql 2005 trace window open and NO sql statements are coming through "ds" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" SelectCommand="my_proc_name" SelectCommandType="StoredProcedure">
Hi All,I have a report ASP.NET page that allow users to run a report by clicking a buttion to call a store procedure to generate the report, however, the store procedure is taking a few minutes to return the data, thus I got the 'timeout' error message on my page. How do I extend the time on my page?Thanks
IF @a NOT IN ('x', 'y') BEGIN RAISERROR ('Error',16,1) RETURN 0 END RETURN 1
If I execute it from SQL Server, it returns 0. (after the error, of course). If I execute it from MS ACCess through a Pass Through Query, it returns 0. On the same server !!! How could it to make me that ? I have been thought the SP is executed entirely on the server !!!
Hello all. I have a stored procedure that seems to skip the execution of an entire line of code (which happens to be a call to execute another stored procedure), but ONLY if it is being used from C# (using the System.Data.SqlClient namespace... object: SqlCommand, etc).
Basic structure:
Event SP: top-most parent -->Calls UpdateXs SP: This is the SP that will not call his child SP ----->Calls UpdateX: This is the SP that is being ignored when called from .NET (In a loop, each iteration, max iterations 10).
(1) I can call the top-most stored procedure (Event SP) with the same arguments in Query Analyzer and all SP's will execute. (2) I can call UpdateXs SP with the same arguments that are being passed to it from Event SP in the Query Analyzer, and again, it's child sp executes (UpdateX). (3) I can also call the last child (UpdateX) directly in Query Analyzer with the same arguments that are passed in production (from executing the top-most parent in C#), and it executes correctly.
I'm positive that at no point the last child (UpdateX) is being passed NULL values. I made debug tables and before execution of an SP from within another SP, I store all the arguments in a debug table--none are null. Also, to figure out what was wrong with the last child (UpdateX) , the first statement in inserts into another debug table, just to show that that execution has made it into the sp--when the top parent is called from C#, it doesn't insert into my table (doesn't execute).
There are statements inside Event SP that execute after the sp call to UpdateXs SP. These statement always execute. Also, there are statements inside UpdateXs SP that execute after the sp call to the last child. These statement always execute too.
I am now clueless. I had developed & debugged all sp's in Query Analyzer before trying to use it live (with the C#). It's always fine in Query Analyzer, but ALWAYS skips the last sp in production.
Is there some fundamental principle I am missing here in MS SQL stored procedures? I am only 3 levels deep in SP calls, so I didn't think that would be an issue (I have made SP's that went a LOT deeper in calls than that in the past with no issues).
I am a student and is currently busy with an SQL project. I am having trouble with creating a view to calculate and display the hours worked for each call rate..
It goes...
I have two tables: rate and consultancydetail.
The rate table consists of columns named - id, time descripiton and rate.
The consultancydetail table - invoiceID, rateID date, startTime and endTime.
My view should display the rateId column and then there should be a column created in the view for the total hours.
total hours is calculated by adding the difference between startTime and endTime and then added to each total for each rateId.
PLEASE CAN SOMEONE HELP. I am new to this and know it should be a simple thing.
Hi,I have a large FoxPro table with an index that I need to be Queried from SQLServer by OLE.DB or ODBC. If I query the DBF directly a search takes 1Minute +. Is there a way I can call the data from the table and use theexisting FoxPro Index?ThanksSteve
I have some libraries (DLL) that I call from a regular console application. The data access methods get the connection string from the app.config, nothing special there.
The thing is: now I need to use the libraries inside a SSIS package. I call them from a script task, and everything is fine, except for the connection string.
Is there a way that I can get the connection string from the SSIS package configuration like I would from the app.config? Maybe some alternative to ConfigurationManager.AppSettings["ConnString"] in the DTS Runtime?
I have a task configured on the post execute event handler of a package expecting this task to be executed only once after the completion of all the other tasks in the package. But I found the task configured on the post execute event of the package getting executed as many times as the number of tasks in the package + 1 . Is there any workaround for this problem?
I have a Stored Procedure, which has a RAISERROR statement with LOG. I am calling this SP from a Job. Whenever the RAISERROR is executed, it also fails the job.. How should this be handled? The article:
http://support.microsoft.com/kb/309802 says that this has been fixed in SP4, but I am working on SQL Server 2000 SP4, but still it persists here. Can anyone please help me resolve issue? Can this be handled in Code? Or, Is it confirmed that even SP4 has not fixed this? Or is this a known issue and we need to live with it?
SP code: ---------------------------- CREATE PROCEDURE dbo.usp_DF_NA_Analytics_OOW AS BEGIN SET NOCOUNT ON
--Declare Variables DECLARE @CURRENTDATE DATETIME DECLARE @BEGINTIME DATETIME declare @feedname varchar(50) set @feedname = 'DF_NA_Analytics_OOW' SET @CURRENTDATE = CURRENT_TIMESTAMP
-- ensure there is a row for us - create 1 if it doesn't exist exec usp_datafeed_timestamp_init @feedname
SET @BEGINTIME = ( SELECT LastRunTime FROM NewAccounts.dbo.DataFeed_Timestamp WHERE TaskName = @feedname )
select oowReason.OOWTransaction_id, oowReason.Position, oowReason.ReasonCode, oowTx.UpdateDateTime from OOWTransaction oowTx (nolock) join OOWReason oowReason (nolock) on oowReason.OOWTransaction_id = oowTx.OOWTransaction_id WHERE oowTx.UpdateDateTime >= @BEGINTIME and oowTx.UpdateDateTime < @CURRENTDATE ORDER BY oowReason.OOWTransaction_id, Position
-- update the timestamp exec usp_UPD @feedname, @currentdate end ------------------------------
ALTER procedure dbo.usp_UPD (@feedname varchar(50), @lastruntime datetime) as begin set nocount on
if not exists (select * from dbo.datafeed_timestamp where lower(taskname) = lower(@feedname)) INSERT INTO Datafeed_Timestamp(TaskName, LastRunTime) VALUES(@feedname, @lastruntime ) else update Datafeed_Timestamp set LastRunTime = @lastruntime where TaskName = @feedname end ----------------------------------------
The above bcp fails consistently unless the "exec usp_UPD" is completely removed. Even if I substitute it with the update stmt instead of the SP call, it still fails.
I move the usp_UPD call and move it above the select making the select as the last command in the SP -- still fails. Removed Order by -- still fails.
The weird thing is -- several other SPs that follow the same exact format (only select query is different) - they all succeed everytime.
This above bcp fails everytime unless the usp_UPD is fully removed. I have tried putting the result dataset into a table variable and select it in the end -- still fails. several other attempt to workaround - fails -- by fails I mean "0 rows returned" from bcp -- when the UPD is removed, it returns the correct dataset. Otherwise always returns 0 rows.
Outside bcp, if I simply execute the SP from QA, it returns the correct dataset everytime. From bcp, it just doesn't like it. It returns 0 rows everytime, but does the UPD task -- the value does get updated adter execution.
When I call DeriveParameters against a function written in SQLCLR function it throws an exception. I've been working on this a little while and haven't found a fix. I understand that I could write additional code to do the same work DeriveParameters does, but it seems like this should work.
This is the exception thrown:
[InvalidOperationException: The stored procedure 'GSI.Utils.IsMatch' doesn't exist.]
The function is defined as
CREATE FUNCTION [Utils].[IsMatch](@Value [nvarchar](4000), @RegularExpression [nvarchar](4000)) RETURNS [bit] WITH EXECUTE AS CALLER AS EXTERNAL NAME [RegularExpressionsHelper].[UserDefinedFunctions].[IsMatch]
The C# function is defined as:
[Microsoft.SqlServer.Server.SqlFunction(IsDeterministic=true)] public static SqlBoolean IsMatch(SqlString Value, SqlString RegularExpression) { Regex rx = new Regex( RegularExpression.ToString() ); string s = Value.ToString();
return new SqlBoolean(rx.IsMatch(s)); }
This is the code I'm using to call DeriveParameters:
static void Main(string[] args) { using (SqlConnection conn = new SqlConnection(m_GetConnectionString())) { conn.Open();
I found that DeriveParameters seems to call sp_procedure_params_managed and when I call it myself it returns the parameters correctly for T-SQL functions, but returns no records when I specify a SQLCLR function.
I'm able to execute the function without issue and I'm able to use DeriveParameters against everything in the database except C# based functions (and I've tried others besides IsMatch). I'm attempting to run DeriveParameters from a console application and from ASP.NET, both running .NET 2.0.
I've experienced the same behavior in these versions:
SQL Server 2005 Enterprise Edition RTM (MSDN Image on Virtual Server) SQL Server 2005 Enterprise Edition SP1 (MSDN Image on Virtual Server) SQL Server 2005 Enterprise Edition SP1 + Hotfix kb918222 (MSDN Image on Virtual Server) SQL Server 2005 Developer Edition SP1