Default Schema Within Storded Procedure

Sep 25, 2007

I'm migrating a dotnetnuke website from SQL Server 2000 to SQL Server 2005 and have run into a problem with one of the stored procedures.

The database objects seem to have upgraded successfully to use the db schema identifer from the dbowner identifier. However I am having a problem with a particular stored procedure trying to execute another stored procedure.

When the following procedure is called, it seems that the db engine has forgotten the schema context and therefore can't find the called procedure. Has anyone come across this before and is there a workaround other than modifing every SP that uses EXEC?


ALTER PROCEDURE [myschema].[dnn_Forum_StatisticsGet]

(

@ModuleID int,

@UpdateWindow int = 12,

@TabId int

)

...
BEGIN

EXEC dnn_Forum_AA_StatisticsSiteUpdate 0, 0, @ModuleID, @TabId

END

...

View 6 Replies


ADVERTISEMENT

Problem Exectuing Storded Procedure

Jul 20, 2005

Hi NG,I've got an ASP Script (useing Javascript) to which i send data to by POST.This data stored in variables will be transferred to SQL stored Procedure.As shown at bottom...welches eine Variable übergebenThere is coming up an error...I don't know how to solve it,please help or give me a hint...[asp code line 665 and + from Functions.asp]var TopicName=String(Request.Form("TopicName"));var TopicContent=String(Request.Form ("TopicContent"));var strSQL="EXECUTE Topic @TopicTitle=["+TopicName+"],@TopicContent=["+TopicContent+"]";cmd.CommandText = strSQL;cmd.Execute;oDB_connect.close;[/asp code][error page]Fehlertyp:Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)[Microsoft][ODBC SQL Server Driver][SQL Server]Bezeichner (beginnend mit'0123456789012345678901234567890123456789012345678 9012345678901234567890123456789012345678901234567890123456789012345678901234567' ) ist zu lang. DieMaximallänge beträgt 128./Functions.asp, line 669[/error page][snip from Stored Procedure]CREATE PROCEDURE dbo.Topic @TopicTitle VARCHAR(20), @TopicContent VARCHAR(200)AS INSERT INTO Table.........etc[/snip from Stored Procedure]

View 10 Replies View Related

Set Default Schema In Code - Possible?

Sep 27, 2007

==SQL Server 2005 SP2==Is it possible to set the default schema in code?I know that, for a particular DB user, I can set the default schemastatically in Mgmt Studio. However, I want to do this dynamicallyin source code.I am using JDBC if that matters.Any help appreciated.TIAaj

View 1 Replies View Related

Create A Default Schema

May 22, 2008



I Would like to create a schema sample and make it as default schema instead of dbo.

If a user logs in and creates a table like create table t1 (no int ) .
it would be assigned to sample schema and displayed as sample.t1 not dbo.t1.


How to set the user created schema as primary schema.

View 9 Replies View Related

Default Schema For NT-group Not Possible

May 4, 2006

We have a new development SQL2005 server.
To implement secutiry on this new server we decided to grant rights to NT-groups.
We defined an NT-group Programmersmembers and gave this group the necessary rights.
The problem now is when a member of this NT-group creates a table (this group is dbo in the development database) everything works fine as expected.
But when a member of this group tries to make a new table through 'Microsoft SQL server management studio' they receive the error that there is no default schema available.
But it seems to be impossible to map a default schema to an NT-Group.

=> Does this means we have no other way than to give each individual programmer the necessary rights and assign them to a default schema.
It is no option to force our programmers to create each table through a script on the development database.

Or is there another option ?

View 7 Replies View Related

How To Remove Default Schema??

Sep 25, 2007

Hi,

Re: sql server 2005

I recently migrated a database from one server to another. In the process of doing this, I renamed one of the sql server 2000 migrated logins to a new name, using "alter login with name" and "alter user with name"

Now, I'm having problems with permissions. This user cannot execute sp_send_dbmail, even though it has explicit execute permissions on this stored proc in the msdb database.

What I noticed about this user is that is carried over a default schema from the old 2000 server. I'm beginning to think that this has something to do with the lost permissions. So I tried to drop the default schema. No dice. Next, I set the default schema to dbo. That still didn't work.

Can someone please tell me how to drop a default schema for a user? I've tried everything I can think of, from removing the schema name from the properties windows, to "alter user". Nothing has worked.

Thanks

View 3 Replies View Related

The Default Schema Does Not Exist.

Mar 31, 2006

During deployment of my database project I receive the following error:

"The default schema does not exist."

What could be causing this error?

View 1 Replies View Related

Default Schema Not Working?

Mar 14, 2006

I am confused.

I added my NT account to the sql server logins for my sql server (2005), then I added a corresponding user account to my database. I then set my default schema. I connect to the database, and the default schema seems to be set to dbo.

Can anyone thing of a reason why this might be happening? Is there some sort of override if I have additional privledges on the server?

I appreciate any thoughts...

-Mike Graham

View 4 Replies View Related

Default Schema SQL Svr Mgt Stdio / 2000

Sep 5, 2007

Hi,

I have SQL Server Management Studio and SQL Server 2000.
What I want to know is:

Is there any way to prevent displaying default schema or owner, when viwing the "tables list" in the object browser?

eg. Instead of
dbo.MyTable1
dbo.MyTable2
....

I want to view as

MyTable1
MyTable2

Thanks


Srinika

View 5 Replies View Related

Unable To Set Default Schema For A Group

Aug 28, 2005

We're using Windows Authentication with our SQL Server.  We've added a domain group to the SQL Server groups and would like to give it a default schema.  The properties window is the same for users and groups but the default schema field is enable only for user entities.  We cannot add a default schema to a group.

View 89 Replies View Related

Problem Renaming Default Constraints In Schema Other Than Dbo

Dec 14, 2007

Does anyone know how to tell sp_rename to look in a schema other than the default.
The code below reproduces the problem.

-- WORKS IN default schema
--
create table dbo.TestDF1(
dfField intconstraint DF1 default 0
)
go

sp_rename 'DF1', 'DF2', 'OBJECT'
go

Select name
From
sys.default_constraints
where
object_name(parent_object_id) = 'TestDF1'
go

drop table dbo.TestDF1
go

-- DOESN'T WORK IN added schema
--
create schema TestSchema
go

create table TestSchema.TestDF2(
dfField intconstraint DF3 default 0
)
go

sp_rename 'DF3', 'DF4', 'OBJECT'
go

Msg 15248, Level 11, State 1, Procedure sp_rename, Line 315
Either the parameter @objname is ambiguous or the claimed @objtype (OBJECT) is wrong.
---------------------------
drop table TestSchema.TestDF2
go

drop schema TestSchema
go

View 2 Replies View Related

Can Sp_grantdbaccess Attach User To Default Schema

Jun 15, 2007

Hi
For MSSQL 2005 server, when we create new user using stored procedure sp_grantdbaccess, it creates schema with name given to user.

While when we create new user with query " Create login identfied by'password'. It attach user to default schema at the server.


My question is can we have a default schema assigned to the user, while user is created with sp_grantdbaccess?

Is there any way to do so?

Please reply as early as possible.

View 3 Replies View Related

Set Default Schema To Current User For Call Database

Apr 20, 2013

i have database and set default table schema to "ray" and me must input ruy.TABLE-NAME for retrive data !!! , i need set Default Schema to current user for call database as just database name(for my program) , how changed it ? (i change default schema for current user by alter command but not worked !)

View 1 Replies View Related

Problem In Assigning Default Schema To Database User

May 6, 2008

Dear All,

I am using SQLServer 2005, I have setup a login user "User1" and next I setup database user using the same username and login name. After that I create a new schema "mySchema" and make "User1" as the owner of the schema. To "User1" I assigned the default schema to "mySchema", so far its working fine. But when I open the user's property window (dialogbox) the default schema always gets reset to "dbo".

What could be the problem here? Please help me if there is any solution to get the right schema which I assigned to the user.


Thanks and regards,



View 4 Replies View Related

Stored Procedure Reference Different Schema

Jul 22, 2013

I am trying to build a stored procedure reference two diffrent tables with same name but diffrent schemas based on the login_user or who calls the procedure. I have developed the following procedure but still ot able to get it..The table test_table exists two times within the system

User1.test_Table

User2.TestTable

if i am user1 calling the procedure should reefernce user1.test_table and vice versa for user 2.

alter procedure dbo.test_proc (@pUsername varchar(150))
with Execute as caller
as
Begin
Select System_User
Select * from Test_Table
End

View 4 Replies View Related

CREATE SCHEMA In Db A From A Stored Procedure In Db B

Apr 18, 2006

Hi All
I have a SP that i create tables and other objects on another database.

Creating table work well.

declare @s nvarchar(2000)
set @s = 'use db01'
set @s = @s + 'CREATE TABLE ABC (recid int)
exec (@s)
------------------------------------------------------------------------

But if i try to create a schema it gives error :
'CREATE SCHEMA' must be the first statement in a query batch.

declare @s nvarchar(2000)
set @s = 'use db01'
set @s = @s + 'CREATE SCHEMA AAA
exec (@s)
How can i solve it?

Thanks.

View 5 Replies View Related

Debug A Stored Procedure In Schema

Nov 26, 2007



hi, i'm trying to debug a stored procedure (in sql server 2005) with visual studio 2005, but all my tables and procedures are inside a schema and when i configure my login in sql server for being in sysadmin role, it dosn't map the schema so i need to write the schema before the tables and procedures, and i don't need it in that way...
how can i do to have a login in sysadmin role and a schema maping in than login???,

thanks ....

View 1 Replies View Related

Creating DB Schema From A Script Or Stored Procedure?

Jan 7, 2005

Hi there,

I am a fairly experienced programmer, but new to SQL Server - I understand basic DB theory well enough, but don't have much practical experience with using SQL Server.

I'm working on a project at the moment, where, as part of the spec, users can create 'systems' in the database. For example, in a parts database for a pumping station, there may be 10,000 parts. Rather than have one huge database for, say, 10 pumping stations, we would prefer to have 10 smaller databases, each dedicated to its own system. The schemas would be identical.

I think one approach to this would be have an empty database in SQL server (with the correct tables/schemas/relationships etc) and then copy that within SQL server, with a new name (the system name), probably using a stored procedure.

My question: Is this possible, is there already a stored procedure in SQL Server (2000) to do this, or do I have to write one? Writing a SP to physically create the database from scratch would be a nightmare, I'm hoping there is a simple 'copy_db to new_db' type stored procedure. Maybe there is a program can read a DB and create a script to re-create the DB under a new name?

Any information greatly appreciated.

Mark Wills.

View 4 Replies View Related

Default Stored Procedure

Jun 5, 2008

Hi,
I wanted to use a default for yearly instead of monthly for stored procedure, but couldn't figure out how. I usually used stored procedure @start and @end for date.
i.e. this is monthly by default
@start = jul 2007 and @end= aug 2007;
i.e. i want yearly by default
@start = jul 2007 and @end= jul 2008.

Is this too confusing?

Please help!!!!!!!!!

View 1 Replies View Related

Can I Use A Store Procedure As Default Value For A Column?

Oct 23, 2006

Is it possible to use a stored procedure to fill the default value of a column when i'm building the db? i mean if i can use a stored procedure for the "colum property": "default value or bnding" if yes how can i do it? 

View 2 Replies View Related

Default Value Of Stored Procedure Parameter

Jul 20, 2007

 Hi,This works:CREATE PROCEDURE MyProc    @Date smalldatetime = '2005-01-01'AS... But this does not CREATE PROCEDURE MyProc    @Date smalldatetime = GETDATE()AS... I'm talking about sql2005. Can anyone help how to overcome this? 

View 3 Replies View Related

Stored Procedure Default Value Question

May 14, 2004

Is there a way inside a stored procedure to determine if a parameter defined with a default value was explicity passed the same value as the default vs. the parameter was omitted and you just got the default value.

E.g. create procedure mysp_stuff @parm1 varchar(20)=NULL, @parm1 bit=0 as
if (@parm1 is null)
begin
-- did we get the default or did the caller pass NULL
end
if (@parm2 = 0
begin
-- did we get the default or did the caller pass 0
end
GO

EXEC mysp_stuff
go
EXEC mysp_stuff @parm1=NULL, @parm2=0
go

View 5 Replies View Related

Default Stored Procedure Parameters

Jul 23, 2005

Hello, does anyone know how to determine (within the stored procedure)whether a parameter has been passed explicitly to a stored procedure asopposed to a parameter that has taken on the default value.Many thanksPhil

View 4 Replies View Related

Stored Procedure To Change Default

Dec 14, 2005

Can someone explain to me why the following doesn't work?declare @oname sysnameselect @oname=name from sysobjects where name like"df__mytable__mycol%"alter table mytable drop constraint @oname

View 4 Replies View Related

The 'System.Web.Security.SqlMembershipProvider' Requires A Database Schema Compatible With Schema Version '1'.

Sep 27, 2007

Locally I develop in SQL server 2005 enterprise. Recently I recreated my db on the server of my hosting company (in sql server 2005 express).I basically recreated the tables and copied the data in it.I now receive the following error when I hit the DB:The 'System.Web.Security.SqlMembershipProvider' requires a
database schema compatible with schema version '1'.  However, the
current database schema is not compatible with this version.  You may
need to either install a compatible schema with aspnet_regsql.exe
(available in the framework installation directory), or upgrade the
provider to a newer version.I heard something about running aspnet_regsql.exe, but I dont have that access to the DB. Also I dont know if this command does anything more than creating the membership tables and filling it with some default data...Any other solutions/thought on what this can be?Thanks!

View 4 Replies View Related

Default Value For A Stored Procedure And Conversion Error

May 30, 2008

When I call this function and the database field 'Login' is null, then I get an error message "Conversion from type 'DBNull' to type 'String' is not valid." I've supplied a default value in my stored procedure and I've also provided a default value in the result value in the function.  How do I get around this?  Thanks 
lblLastUserLogin.Text = GetLastUserLogin().ToString()
Private Function GetLastUserLogin() As String        Dim result As String = ""        Dim con As New SqlConnection("server=x.x.x.x;database=database;uid=x;password=x")        Dim cmd As New SqlCommand("GetLastUserLogin", con)        cmd.CommandType = CommandType.StoredProcedure        cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = lblUserID.Text        cmd.Parameters.Add("@ReturnVal", SqlDbType.SmallDateTime).Direction = ParameterDirection.Output        Using con            con.Open()            cmd.ExecuteNonQuery()            result = CType(cmd.Parameters("@ReturnVal").Value, String)        End Using        Return resultEnd Function 
CREATE PROCEDURE [dbo].[GetLastUserLogin]     -- OUTPUT parameter to hold the count.    @UserID int,     @ReturnVal smalldatetime = ' ' OUTPUT AS     -- This will return the last date returned by the SELECT query.     Set @ReturnVal = (SELECT MAX(Login) FROM TUserLogs WHERE UserID=@UserID)

View 2 Replies View Related

CANT We Set Default Value Null To Parameter In Stored Procedure

Feb 18, 2008



Hello

I've written a stored procedure with 4 parameters

create procedure dummy
( @a int, @b int, @c varchar(50), @d varchar(50))

now from front end(I'm using c#.net)
I want to send the values according to some criteria
So in the process...I've only values for @a & @c ...

so In order to reduce the code of sending Null values explicitly to other parameters...

can't I set like default values for it so that If I don't send values to certain parameters it will have the default value or Null value.

like I want something like this:

create procedure dummy
( @a int NULL, @b int NULL, @c varchar(50) NULL, @d varchar(50) NULL)

View 1 Replies View Related

Transferring Objects Form Schema A To Schema B In One Shot....!

May 27, 2008

I have 35+ tables and 15+ stored procedures with SchemaA, now I want to transfer them to SchemaB.

I know how to do one by one...!

alter schema SchemaB transfer
SchemaA.TableA

but it will take long time...!

Thanks,

View 3 Replies View Related

Retrieving Default Values For Parameters In A Stored Procedure.

Jul 23, 2005

I'm generating a list of parameters needed by stored procedures, and
I'd like to know which ones have default values assigned to them.
To retrieve the parameter information I use:


sp_sproc_columns @Procedure_Name='InsertUser''


However, the column that is supposed to give the default value,
'COLUMN_DEF' always returns as NULL, even when that column has a
default value assigned to it.
i.e.
CREATE PROCEDURE InsertUser@UserID INT = 10,.....


And then if I do a sp_sproc_columns @Procedure_Name='InsertUser'', the COLUMN_DEF value for the @UserID column is still NULL.

Does anyone know what I'm doing wrong and how I can retrieve the default value?

Thanks

View 1 Replies View Related

Stored Procedure Using A Parameter Default To Select ALL Records - Help Please

Jan 6, 2006

Hi everyone,
I have created a stored procedure in sql server with parameters for my c# application. Wanted to know is there anyway to set the default value for @searchpostcode to select all the records?
Right now it brings the records based on the postcode specified .(I have dropdownlist in my c# application that passes the parameters for postcode)
My stored procedure:
CREATE PROCEDURE sp_accepting_practice  (@searchpostcode as nvarchar(100))  AS
SELECT   dbo.tbdentists.Title, dbo.tbdentists.FirstName, dbo.tbdentists.Surname, dbo.tbpractices.PracticeName, dbo.tbpractices.PracticeAddress1, dbo.tbpractices.PracticeAddress2, dbo.tbpractices.Town, dbo.tbpractices.Postcode, dbo.tbpractices.Phone, dbo.tbdentistspractices.ListNo, dbo.tbtreatment.treatmentNatureFROM         dbo.tbdentists INNER JOIN dbo.tbdentistspractices ON dbo.tbdentists.DentistId = dbo.tbdentistspractices.DentistId INNER JOIN                      dbo.tbpractices ON dbo.tbdentistspractices.PracticeId = dbo.tbpractices.PracticeId AND                       dbo.tbdentistspractices.PracticeId = dbo.tbpractices.PracticeId INNER JOIN                      dbo.tbtreatment ON dbo.tbdentistspractices.TreatmentId = dbo.tbtreatment.treatmentIdWHERE   dbo.tbpractices.Postcode LIKE '%' + @searchpostcode + '%'ORDER BY dbo.tbpractices.PracticeId
EXECUTE sp_accepting_practice   G4GO
I greatly appreciate your help. Thanks in Advance
Regards
Shini
 
 
 
 

View 9 Replies View Related

What Does A Stored Procedure Recieve From A SqlDataSource Who's Parameter Is Empty And No Default Value Set?

Nov 24, 2006

If a sqldatasource is programed to send textbox1.text to a stored procedure, and the .text property is left empty, and there is no default value set for the parameter, what exactly is the stored procedure receiving?I would like to run a IF BEGIN statement on the value of the parameter in the stored procedure but the following does not work:IF @Parameter IS NULL BEGINor IF @Parameter = '' BEGINThe only way I've gotten it to work is if I set the default value of the parameter being sent to a specific alphanumeric value. Then do something like:IF @Parameter = '99' BEGIN<Code Here>END 

View 4 Replies View Related

Database Schema Compatible With Schema Version '1'

Apr 12, 2008

Hello everybody!I'm using ASP.NET  3.5,  MSSQL 2005I  bought virtual web hosting .On new user registrations i have an error =(The 'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version. On my virtual machine it work fine but on web hosting i have an error =(What can you propose to me?

View 2 Replies View Related

Moving Data From One DB Schema To Another DB Schema Using SSIS

May 8, 2007

Hello,



I would like to use SSIS tool to move the data from one database schema to another database schema.



For example:



Source table has

1. UserName (varchar 20) (no null)

2. Email (varchar 50) (can be null)



Destination table has



1. UserID (uniqueidentifier - GUID)

2. UserName (varchar 50) (no null)

3. EmailAddress (nvarchar 50) (can be null)

4. DateTime



Questions:



1. What controls do I use in my Data Flow to make data move between databases with different data types and include new value in UserID as a new GUID and DateTime as a date (GETDATE)?

OLE DB Source, OLE DB Destination, Data Converson and .....

How do I insert Guid and Date at the same time?





2. I have many tables to do data moving. Any sugestions? How do I architect my project? If I create many data flows for each table - it will look complicated.



Please give me some advices here.



Thanks.

View 3 Replies View Related







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