Setting The Schema For An SP/Function

Feb 21, 2008



Hi Guys,

I wanted to know how to set the schema for a stored procedure/function. I have some tables, T-SQL stored procedures and fuctions under schema MYSOFT and I call them as follows

MYSOFT.LOOKUP_REC

I have now written some c# SP's and Functions and want to add them to the MYSOFT Schema, how would I do this. I have tried setting the Assemly Owner value to MYSOFT in the project properties but it doesnt seem to work. I can see all my other functions & SP's having the schema name as their post fix in braces

FIND_NAMES (MYSOFT)

but not my c# ones.

When I try to access my C# Function with the schema name MYSOFT I get an error message

'Cannot find either column 'MYSOFT' or the user-defined function or aggregate 'MYSOFT.FIND_NAMES' or the name is ambiguous'

I would appreciate any help

Thanks & Regards

View 4 Replies


ADVERTISEMENT

Setting A Schema Context For A Session

Apr 25, 2006

Is there a way to specify a given Schema as the currently active one for a given database session ? i.e. im looking for somthing like:

Use Schema=<name>

Execute Queries / Stored Procs, etc

.....

I want all the Queries and Stored Procs to execute on the Schema set initially.

I can't use the Default_Schema on the User to do this due to certain restrictions in the way we create users and Schemas.

I know that i can always qualify the objects in the Queries with a Schema Name, but i have a requirement where the Queries need to be generic in nature and need to run on one of many identical schemas in the Database. Is this Possible in Sql Server?

Any help will be greately appreciated.

Thanks

View 3 Replies View Related

Guides On Setting Up Schema For A Database Wanted

Jan 16, 2008

In my SQL Server 2005, we stored multiple application tables in a single database. All of them is using the dbo schema in the past.

Now, we would like to change this practice and adopt a better one. However, we got some problems in the configuration.

If I want to create such a database, should I first create multiple logins and multiple users for all the application. The mulitple logins are used in the connectionstring of my web. While each login can only have 1 user in a database, I need to create a user for each login as well. (Am I correct in doing so? It seems a bit messy.)

The other problem is what should the database role of all that users? If I don't grant them the db_owner. They can't create the required tables. If I grant it, it voliate the intension of separating different application...

Please help. I am a bit lost on this now. Thanks!

View 1 Replies View Related

Can Delete 'dbo.' Schema When Call Function In SP

Nov 21, 2007

Hi:

We found the problem that when the SP call function,there must have 'dbo.' before the function.Does it necessarily?Can delete 'dbo.' schema when call function in SP?

View 1 Replies View Related

Schema Advice For Private Message Function

Jul 16, 2007

 Hi Guys, I've got a bit stuck trying to decide on a table structure for a private message like part of a site I'm building (I'm using SqlServer 2000, not that it really matters).at first I was going to use a single table with the following schema: MessageId intReplyToMessageId int (nullable)FromUserId uniqueidentifier (I'm using .net membership)ToUserId uniqueidentifier IsRead bitIsDeleted bitSubject nchar(50)Body nvarchar(1000) DateCreated datetimeDateUpdated datetimeCreatedBy uniqueidentifierModifiedBy uniqueidentifier What strikes me here is that I'm using alot of guids (which are huge) and if I'm going to be threading the messages (which I am) there's no easy way to return an ordered list of messages that are replies to each other. So then I thought about introducting a messageThreads table, but I can't think of anything to store there apart from a threadid (which seems to defeat the purpose)Any ideas? I can clarify more if necessary. Thanks  

View 6 Replies View Related

Problem Creating Function To Be Schema Independent

Apr 1, 2008

I am writing a SQLServer script that I want to be schema name independent. I mean I know that all users of the script will have the same tables, but not necessarily the same schema name.

When I hard code the script to use the name of my schema, wcadmin, it works OK.

CREATE FUNCTION wcadmin.dectohex(@a numeric)
RETURNS varchar(8)
BEGIN
DECLARE @x varchar(8)
DECLARE @y varchar(1)
DECLARE @z numeric
DECLARE @w numeric

SET @w=@a
SET @x=''

WHILE @w > 0
BEGIN
SET @z = @w % 16;

SET @y= CASE @z
WHEN 10 THEN 'A'
WHEN 11 THEN 'B'
WHEN 12 THEN 'C'
WHEN 13 THEN 'D'
WHEN 14 THEN 'E'
WHEN 15 THEN 'F'
ELSE CAST(@z AS varchar)
END

SET @w = ROUND(@w/16,0,1)
SET @x = @y + @x
END

-- Pads the number with 0s on the left
SET @x = RIGHT(REPLICATE('0',8) + @x ,8)
RETURN @x
END;
GO

select 'WTDOCUMENT' HOLDER,
dm.WTDocumentNumber ITEMNUMBER,
dm.name ITEMNAME,
ad.fileName ContentFilename,
fh.hostName VaultHost,
wcadmin.dectohex(fi.uniqueSequenceNumber) VaultFile,
fm.path VaultPath
from
WTDocument di,
WTDocumentMaster dm,
HolderToContent hc,
ApplicationData ad,
FvItem fi,
FvFolder ff,
FvMount fm,
FvHost fh
where di.idA3masterReference = dm.idA2A2
and fm.idA3A5 = ff.idA2A2
and fm.idA3B5 = fh.idA2A2
and fi.idA3A4 = ff.idA2A2
and ad.idA3A5 = fi.idA2A2
and hc.idA3B5 = ad.idA2A2
and hc.idA3A5 = di.idA2A2

DROP FUNCTION wcadmin.dectohex;
GO

But when I remove my schema name I get the error

'dectohex' is not a recognized built-in function name.

In this case I'm just using :-

CREATE FUNCTION dectohex(@a numeric)
.
.
.
.
select 'WTDOCUMENT' HOLDER,
dm.WTDocumentNumber ITEMNUMBER,
dm.name ITEMNAME,
ad.fileName ContentFilename,
fh.hostName VaultHost,
dectohex(fi.uniqueSequenceNumber) VaultFile,
.
.
.
.
DROP FUNCTION dectohex;

Creating and dropping the function seems to work OK when I drop the schema name, I just can't call it.

I've been trying various permutations of dbo and [dbo] prefixes unsuccessfully.

Any suggestions?

Thanks


David

View 5 Replies View Related

Setting Value Returned Via App_name() Function

Jul 31, 2007

Is there a way to set what value is returned via app_name function?

I have a SQL Server 2005 database that is written to by a MS Access front end... but I have users who have written their own access front ends that are manipulating data incorrectly. I want to allow the approved access applications but disallow the user written ones.

Application roles are not an option because there is also a propietary software package that writes to the databases that we would not be able to modify to work with application roles. Allowing a whitelist of named applications is my only way to pull this off.

How can I make MY access application report nameX instead of Microsoft Access or other similar generic name?

View 5 Replies View Related

Setting The Column Property Description With A SQL Function Call

Feb 2, 2008

I am trying to figure out how to set the Description of a Column in my database table by making a SQL function call. I know that I can go into Microsoft Studio Express and type in each desciption for each column. I just have about 1000 variables and each variable's description is in an Excel spreadsheet. I want to be able to build SQL code that will set each of the 1000 variables own description.

Thanks for any help.

Wesley Marshall

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

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

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

Adding A XML Schema To XML Schema Collection

Apr 19, 2006

I used SSEUtil to add a schema to my database but I am having problems.  Used these steps:SSEUtil -c> USE "c:Rich.mdf"> GO>!RUN Resume.SQL//indicates success>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS>GO//schema not shown in list> USE master>GO>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS>GO//schema is shown in the queryIt appears that the schema is not added to the desired database, so when I try to use the schema in Visual Studio, the schema does not appear when I connect to the Rich.mdf database.  Any ideas on what I am doing wrong or why this might be happening?ThanksKevin

View 3 Replies View Related

Copy Objects From One Schema To Another Schema?

Nov 21, 2011

I am using sql server 2008 R2.I want to copy all the objects of one schema and put it in another schema. I want to do that from command prompt.

In oracle we can export the objects of one user and import to another user using exp and imp. I want similar type.

View 5 Replies View Related

Help Convert MS Access Function To MS SQL User Defined Function

Aug 1, 2005

I have this function in access I need to be able to use in ms sql.  Having problems trying to get it to work.  The function gets rid of the leading zeros if the field being past dosn't have any non number characters.For example:TrimZero("000000001023") > "1023"TrimZero("E1025") > "E1025"TrimZero("000000021021") > "21021"TrimZero("R5545") > "R5545"Here is the function that works in access:Public Function TrimZero(strField As Variant) As String   Dim strReturn As String   If IsNull(strField) = True Then      strReturn = ""   Else      strReturn = strField      Do While Left(strReturn, 1) = "0"         strReturn = Mid(strReturn, 2)      Loop   End If  TrimZero = strReturnEnd Function

View 3 Replies View Related

In-Line Table-Valued Function: How To Get The Result Out From The Function?

Dec 9, 2007

Hi all,

I executed the following sql script successfuuly:

shcInLineTableFN.sql:

USE pubs

GO

CREATE FUNCTION dbo.AuthorsForState(@cState char(2))

RETURNS TABLE

AS

RETURN (SELECT * FROM Authors WHERE state = @cState)

GO

And the "dbo.AuthorsForState" is in the Table-valued Functions, Programmabilty, pubs Database.

I tried to get the result out of the "dbo.AuthorsForState" by executing the following sql script:

shcInlineTableFNresult.sql:

USE pubs

GO

SELECT * FROM shcInLineTableFN

GO


I got the following error message:

Msg 208, Level 16, State 1, Line 1

Invalid object name 'shcInLineTableFN'.


Please help and advise me how to fix the syntax

"SELECT * FROM shcInLineTableFN"
and get the right table shown in the output.

Thanks in advance,
Scott Chang

View 8 Replies View Related

A Function Smilar To DECODE Function In Oracle

Oct 19, 2004

I need to know how can i incoporate the functionality of DECODE function like the one in ORACLE in mSSQL..
please if anyone can help me out...


ali

View 1 Replies View Related

Using RAND Function In User Defined Function?

Mar 22, 2006

Got some errors on this one...

Is Rand function cannot be used in the User Defined function?
Thanks.

View 1 Replies View Related

Pass Output Of A Function To Another Function As Input

Jan 7, 2014

I need to be able to pass the output of a function to another function as input, where all functions involved are user-defined in-line table-valued functions. I already posted this on Stack Exchange, so here is a link to the relevant code: [URL] ...

I am fairly certain OUTER APPLY is the core answer here; there's *clearly* some way in which does *not* do what I need, or I would not get the null output you see in the link, but it seems clear that there should be a way to fool it into working.

View 5 Replies View Related

I Want A Function Like IfNull Function To Use In Expression Builder

Jul 24, 2007

Hi,

I wonder if there a function that i can use in the expression builder that return a value (e.g o) if the input value is null ( Like ifnull(colum1,0) )



i hope to have the answer because i need it so much.



Maylo

View 7 Replies View Related

Setting Timeout In ASP.NET Vs Setting Timeout In SQL Server

Oct 22, 2007

In my ASP.NET app, I'm executing a stored procedure via a SQLCommand the searches a customer database. I believe the default timeout is 90 seconds. I'm curious of what happens to the SQL Server Stored Procedure after timing out from the ASP.NET application. Does it timeout at the same time or do you have to set up a value in SQL Server?

View 1 Replies View Related

ROW_NUMBER() Function Is Not Recognized In Store Procedure.(how To Add ROW_NUMBER() Function Into SQL SERVER 2005 DataBase Library )

Feb 4, 2008

Can anybody know ,how can we add  builtin functions(ROW_NUMBER()) of Sql Server 2005  into database library.
I get this error when i used into storeprocedure :
ROW_NUMBER() function is not recognized in store procedure.
i used MS SQL SERVER 2005 , so i think "ROW_FUNCTION()" is not in MS SQL SERVER 2005 database library.
I need to add that function into MS SQL SERVER 2005 database library.
Can anbody know how we can add that function into MS SQL SERVER 2005 database library?
 

View 4 Replies View Related

Function To Call Function By Name Given As Parameter

Jul 20, 2005

I want to write function to call another function which name isparameter to first function. Other parameters should be passed tocalled function.If I call it function('f1',10) it should call f1(10). If I call itfunction('f2',5) it should call f2(5).So far i tried something likeCREATE FUNCTION [dbo].[func] (@f varchar(50),@m money)RETURNS varchar(50) ASBEGINreturn(select 'dbo.'+@f+'('+convert(varchar(50),@m)+')')ENDWhen I call it select dbo.formuła('f_test',1000) it returns'select f_test(1000)', but not value of f_test(1000).What's wrong?Mariusz

View 3 Replies View Related

Error While Creating Inline Function - CREATE FUNCTION Failed Because A Column Name Is Not Specified For Column 1.

Apr 3, 2007



Hi,



I am trying to create a inline function which is listed below.



USE [Northwind]

SET ANSI_NULLS ON

GO

CREATE FUNCTION newIdentity()

RETURNS TABLE

AS

RETURN

(SELECT ident_current('orders'))

GO



while executing this function in sql server 2005 my get this error

CREATE FUNCTION failed because a column name is not specified for column 1.



Pleae help me to fix this error



thanks

Purnima

View 3 Replies View Related

Schema Changes

Jun 25, 2001

SQL 7.0 SP3 replicating a database from a publisher to a SQL 7.0 SP 3 subscriber.

Is there a way to change publisher schema without stopping the replication? Example Add a 'bit' column to a table with default of '0'.

View 1 Replies View Related

DB Schema...

Jun 3, 2004

Hi all,

I want to set up a db for an e-commerce site. I need to know how to set up the db correctly with out getting anything mixed up ... 'cos I never done an e-commerce db b4:

I need to know where and how to store the passwords, the product pictures and the customers delivery address which is different from the billing address.

The tables are as follows...

--Customer--
CustID
Email (email & pwd is for login)
password (will this be secure here)
Name
Address (should it all be in one column or firstline,secondline,zipcode columns)
DeliveryAddress

--Product--
ProductID
ItemName
Catogary
Price
SellingPrice
Quantity
ItemsPicture...(not sure where to link the pics to)
DistributorsID (the warehouse who dispatches the item)

--Distributors--
DistributorsID
Name
Company
Address

It would be much appreciated if you could share some info and tips for how to set it up all correctly.

Tools I'll be using are, ASP.NET(C#), ADO.NET, MSSQL (Stored procedures)

Thanks In Advance

View 4 Replies View Related

Schema

May 28, 2007

HI All,

What Is Schema in sql Server 2005 ?

View 4 Replies View Related

What Is A Schema

Nov 23, 2007

Good afternoon

could someone tell what is a schema is when using within SQL SERVER 2005

Many thanks

Rob

View 3 Replies View Related

What Does Schema Mean?

Aug 26, 2005

I know in SQL Server the terms Database and Catalog are usedinterchangably. But a table is also assigned a schema. As seen in theINFORMATION_SCHEMA.Tables View. I don't get what this schema qualifieris all about. Like if a table has a schema of dbo.Can someone explain the relationship the schema has and what it is?Thanks.

View 10 Replies View Related

Schema Changes

Nov 8, 2006



I have setup merge replication between two machines and the data seems to be updating when changed on either side ok. However I am now looking at how I can handle schema changes. I have found on msdn (although not tried) stored procedures that will add and remove columns, but what happens if I want to delete a table for example.

At the moment I can deselect the table being deleted from being published and then delete it or modify it in Management Studio, which then means I need to create a new snapshot which can take sometime before the change is updated on the subscriber.

Is there a better way to tackle schema updates that I have not found yet? Also, how will the subscriber cope if someone starts modifying data while synchronisation to the new snapshot is going on.

I am using SQL 2005 by the way.

Thanks

John

View 1 Replies View Related

What Is Schema ?

Oct 17, 2006

Hi,

I am new to SQL Server and started it with SQL Server Express.

I tried unfruitful to know about 'Schema' in SQL Server.

I have to mention it as prefix for table name in SQL query. But if it is in "dbo" schema, it is not required.

Please tell me about it..

Thanks

View 1 Replies View Related

Schema Problems

Nov 19, 2006

I wrote a website that hits an SQL Server DB using queries that directly acces the table name with no Schema references. (Ex: SELECT * FROM tblHelpNotes;) I have also backed the file and and somehow (I have forgotten how I managed to import it.) imported it into SQL Server Express to run at home. The problem I am having is that in order to query at home I HAVE to use the Schema or it won't work. (Ex: SELECT * FROM dbo123456.tblHelpNotes;) How can I change this so I can just hit the table directly? I have tried miserable to set up a user that uses the default schema of db123456 but I can't seem to get it to work. Any idea's to point me in the right direction?

View 2 Replies View Related

Need To Get Schema And Data From 6.5 To 7.0

Jun 19, 2000

Hi,

i need to move the data and schema from 6.5 to 7.0. could you please tell me the most simple way.


thank you

raju

View 1 Replies View Related







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