Showing posts with label exists. Show all posts
Showing posts with label exists. Show all posts

Monday, March 26, 2012

Named Instance SQL 7 / SQL 2K

We have a server by name TEST and SQL 7 installed and exists a login 'xx'
and password 'xx'
Recently we installed a named instance SQL 2K on TEST by name TEST\TEST2K
and with a login 'xx' and password 'abc'
I created an alias for TEST\TEST2K as TEST2K
From TEST, Executed sp_addlinkedserver TEST2K
When I try executing from TEST , logged in as 'xx' and password 'xx'
SELECT * FROM TEST2K.MYDB.DBO.MYTABLE
error message
Server: Msg 18456, Level 14, State 1, Line 1
Login failed for user 'xx'.
Is this because of the password difference for 'xx' in TEST and TEST2K '
How to handle this '
Thanks
ShamimSee if this helps...
exec sp_addlinkedserver 'TEST2K','','SQLOLEDB','TEST\TEST2K'
exec sp_addlinkedsrvlogin 'TEST2K','false',null,'xx','abc'
--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net
"Shamim" <shamim.abdul@.railamerica.com> wrote in message
news:OV0C$P%23eDHA.1828@.TK2MSFTNGP10.phx.gbl...
> We have a server by name TEST and SQL 7 installed and exists a login 'xx'
> and password 'xx'
> Recently we installed a named instance SQL 2K on TEST by name TEST\TEST2K
> and with a login 'xx' and password 'abc'
> I created an alias for TEST\TEST2K as TEST2K
> From TEST, Executed sp_addlinkedserver TEST2K
> When I try executing from TEST , logged in as 'xx' and password 'xx'
> SELECT * FROM TEST2K.MYDB.DBO.MYTABLE
> error message
> Server: Msg 18456, Level 14, State 1, Line 1
> Login failed for user 'xx'.
> Is this because of the password difference for 'xx' in TEST and TEST2K '
> How to handle this '
> Thanks
> Shamim
>|||Thanks oj..It worked !!!! much appreciated.
Shamim
"oj" <nospam_ojngo@.home.com> wrote in message
news:e$v$do$eDHA.2748@.TK2MSFTNGP11.phx.gbl...
> See if this helps...
> exec sp_addlinkedserver 'TEST2K','','SQLOLEDB','TEST\TEST2K'
> exec sp_addlinkedsrvlogin 'TEST2K','false',null,'xx','abc'
> --
> -oj
> RAC v2.2 & QALite!
> http://www.rac4sql.net
>
> "Shamim" <shamim.abdul@.railamerica.com> wrote in message
> news:OV0C$P%23eDHA.1828@.TK2MSFTNGP10.phx.gbl...
> > We have a server by name TEST and SQL 7 installed and exists a login
'xx'
> > and password 'xx'
> > Recently we installed a named instance SQL 2K on TEST by name
TEST\TEST2K
> > and with a login 'xx' and password 'abc'
> >
> > I created an alias for TEST\TEST2K as TEST2K
> > From TEST, Executed sp_addlinkedserver TEST2K
> >
> > When I try executing from TEST , logged in as 'xx' and password 'xx'
> >
> > SELECT * FROM TEST2K.MYDB.DBO.MYTABLE
> >
> > error message
> > Server: Msg 18456, Level 14, State 1, Line 1
> > Login failed for user 'xx'.
> >
> > Is this because of the password difference for 'xx' in TEST and TEST2K
'
> >
> > How to handle this '
> >
> > Thanks
> > Shamim
> >
> >
>

Monday, March 19, 2012

N - curious?

Looking at an if exists statement created by SQL Enterprise Manager such as:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[DeleteAllData]') and OBJECTPROPERTY(id, N'IsProcedure') =
1), what does the N do? I've seen cases where it is and isn't necessary, but
I cannot find documentation telling what it does. "N" is a very ineffective
search!!!The N represents a Unicode string.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"CR" <c@.home.com> wrote in message
news:%23DDNZixYGHA.4424@.TK2MSFTNGP05.phx.gbl...
Looking at an if exists statement created by SQL Enterprise Manager such as:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[DeleteAllData]') and OBJECTPROPERTY(id, N'IsProcedure') =
1), what does the N do? I've seen cases where it is and isn't necessary, but
I cannot find documentation telling what it does. "N" is a very ineffective
search!!!|||See the Books Online topic 'Server-side Programming with Unicode'
(http://msdn2.microsoft.com/en-us/library/ms191313(SQL.90).aspx).
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"CR" <c@.home.com> wrote in message
news:%23DDNZixYGHA.4424@.TK2MSFTNGP05.phx.gbl...
> Looking at an if exists statement created by SQL Enterprise Manager such
> as: if exists (select * from dbo.sysobjects where id =
> object_id(N'[dbo].[DeleteAllData]') and OBJECTPROPERTY(id, N'IsProcedure')
> = 1), what does the N do? I've seen cases where it is and isn't necessary,
> but I cannot find documentation telling what it does. "N" is a very
> ineffective search!!!
>

Wednesday, March 7, 2012

My Table that uses aspnet foreign Keys wont display anything - CAUTION - Noob at work

I've created a new table in ASPNETDB.mdf called 'customerInfo'. Most of the fields are, for the moment, data that exists in one of the existing ASPNET tables eg Membership_UserId (primary key), Membership_Email, Users_UserName etc.; the list goes on. I have put a new column 'amountspent' - just to test that I can do what I think I can do, however the table doesn't display any data. Am I OK in thinking that I can use the aspnet data in my own tables and reference through foreign keys to them. I've made sure that the procedure that I used to put the table into a gridview on the webpage is OK as I did the same thing to the membership table and that displays all of its data. Can someone either explain the steps I need to make this happen correctly or point me in the direction of a noob type walkthrough.

Thanks

ps I've used several different ways to link the tables. First I tried building the relationships through the SqlMembershipProvider, created tables and added the foreign keys. Not sure of whether I'd done this correctly, I then used the diagram method which is pretty straightforward, however the result is the same. Surely now these tables are keyed to the UserId of aspnet_Users they should build and display a table of my existing test membership - even if the other fields, for the moment, are not carrying any data?