Showing posts with label mei. Show all posts
Showing posts with label mei. Show all posts

Friday, March 23, 2012

Invalid object name dbo.getname ?

someone please help me?

i've made this used-defined function and sql won't let me use it,

CREATE FUNCTION dbo.getname (@.sname varchar(255))
RETURNS TABLE
AS

RETURN
SELECT ISNULL((select (c.firstname + ' ' + c.surname) from contacts.dbo.c_contact as c where c.employ_ref LIKE @.sname), @.sname) as FullName

using it,

select dbo.getname(c.EMPLOY_REF)
from c_contact as c

but everytime i try to use it i get,

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.getname'.

what's wrong with it?, i should have rights, i am set as sysadmingot it to work,

CREATE FUNCTION dbo.getname (@.sname nvarchar(255))
RETURNS nvarchar(255)
AS

BEGIN
DECLARE @.ss as nvarchar(255)
SET @.ss = (
SELECT ISNULL((select (c.firstname + ' ' + c.surname) from contacts.dbo.c_contact as c where c.employ_ref LIKE @.sname), @.sname) as FullName
)
RETURN(@.ss)
END

Friday, February 24, 2012

Intersolv ODBC Driver

Help me!
I try to import some data from an informix 5.0 table to Sql Server 2000 with
a DTS package.
I use Intersolv ODBC driver version 03.011.0021 to connect to the database.
It works well, but i can't define a parameter in the sql statement. For
example if a try to execute :
select *
from table
where field = ?
The dts environment give me an "unspecified syntax error...."
Where is the problem?
The driver don't support parameters or these must be defined with another
syntax?
Bye
DanieleCan you post a code snippet?
SQL Server T-SQL doesn't support anything close to that syntax so I'm not
sure what you're doing exactly...
From T-SQL, you would need to build dynamic SQL or use sp_exectutesql to do
the parameterization you're talking about.
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Nonno Oreste" <dffdfd@.dfd.dfd> wrote in message
news:OSsw2unuDHA.1596@.TK2MSFTNGP10.phx.gbl...
quote:

> Help me!
> I try to import some data from an informix 5.0 table to Sql Server 2000

with
quote:

> a DTS package.
> I use Intersolv ODBC driver version 03.011.0021 to connect to the

database.
quote:

> It works well, but i can't define a parameter in the sql statement. For
> example if a try to execute :
> select *
> from table
> where field = ?
> The dts environment give me an "unspecified syntax error...."
> Where is the problem?
> The driver don't support parameters or these must be defined with another
> syntax?
> Bye
> Daniele
>