|
Hi there,
Hope someone can help me,
I'm trying to resolve orphaned users in SQL server.
I created a procedure that works very nice in SQL server 2005, but it's having problems in SQL server 2000.
Here is the problem part of my code:
create table #Users(
username varchar(20),
userId varchar(250))
insert into #Users
exec sp_change_users_login 'Report'
select * from #Users
Then I get this error:
Server: Msg 15289, Level 16, State 1, Procedure sp_change_users_login, Line 27
Terminating this procedure. Cannot have an open transaction when this is run.
Hope you can help.
Thank you
|
|
|
|
|
Hi again,
Ok, I'm going to post my own fix on this :P
But would still like ideas on the original problem, if someone has.
I basically just did what the SP did in a short query:
select name AS UserName, sid AS UserSID
from sysusers
where issqluser = 1
and (sid is not null and sid <> 0x0)
and suser_sname(sid) is null
order by name
Kind regards
|
|
|
|
|
Hello all,
I have a products table (see below)
Product State
Apple |1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|2 0|21|22|23|24|25|26|27|
I have to display the state data on a webform replacing the numbers with actual state names for example replace 1 with auckland, 2 with northland and so on. How to do this in SQL.
the returned data from my sql query should look like this string, how do i write the query to acheive this.
Auckland Northland Waikatoo
Please help.
Cheers, Shilpa.
Thanks in Advance for your help. Best Regards
|
|
|
|
|
tblProductsS (table)
(columns)
Product_ID int
Product_Name Nvarchar
State Nvarchar
tblState (table)
(Columns)
State_Id int
State_Name Nvarchar
sql
----
DECLARE @SQLQuery AS NVARCHAR(2000)
DECLARE @SubQuery AS NVARCHAR(100)
select @SubQuery=Replace(State,'|',',') from tblProductsS where Product_ID = 1 --@ProductID
SET @SQLQuery = 'Select State_Name from tblstate where State_ID IN ('
SET @SQLQuery = @SQLQuery + @SubQuery
SET @SQLQuery = @SQLQuery + ')'
EXEC sp_executesql @SQLQuery
Regards John
|
|
|
|
|
We can do this, if you can give us more information about other tables like
a)Where is the state information stored? Is it in a separate table and how "product" table and this table are related?
b)What input you pass to the query EX: you just wanted to pass the number Ex: 1 or 2 etc right?
I can provide you currently the abstract code it will look some thing like this.
Suppose the input request from webform to db is '15'
Declare @check_cond int
Select @check_cond = PATINDEX('%15%',product state)
from products
Now, @check_cond contains the position of your input in the product state column of products table. patindex returns zero if it does not match your input.
Thanks!
Santhosh Kumar Edukulla
|
|
|
|
|
PATINDEX function returns the starting position of the pattern within the string being searched.
I don't think this is neccessary...
Regards John
|
|
|
|
|
Patindex is used to check whether the given 'id' is in products table.
Then Use the same input id to query the productstate table to know the statename accordingly.
Thanks!
Santhosh Kumar Edukulla
|
|
|
|
|
I have a requirement to mark duplicate records when I pull them from the database.
However, I only want to mark the 2nd, 3rd, 4th etc record - not the first one.
The code I have below creates a column called Dupes but marks all the duplicates - including the first one.
Is there a way to only mark the 2nd, 3rd, 4th etc record ?
SELECT *, cs.CallStatusDescription as CSRStatusDesc, cs2.CallStatusDescription as CustomerStatusDesc, (Select MAX(CallAttemptNumber)From CallResults cr Where cl.Id = cr.CallLogId) as CallAttemptNumber,
Dupes = (select count(id)
from CallLogs
where (CustomerHomePhone != '' AND cl.CustomerHomePhone = CustomerHomePhone)
OR (CustomerBusinessPhone != '' AND cl.CustomerBusinessPhone = CustomerBusinessPhone)
AND DealerId= 'hdsh'
AND CSRStatus IS NULL
and datediff(d, logdate, getdate()) <= 21),
FROM CallLogs cl
left Join CallStatus cs on cs.Id = cl.CSRstatus
left Join CallStatus cs2 on cs2.Id = cl.Customerstatus
Where SaleStage IN ('1', '2', '3', '4', '5', '6') And (LogProcessFlag = 1 Or LogProcessFlag = 0)
And DealerId='hdsh'
And Logdate Between '08/01/2007' And '08/31/2007'
|
|
|
|
|
id<=c1.id
add one more condition (id<=c1.id) to the subquery which Dupes column will generate a sequence num for the subsequent duplicate records. All Dupes with value (1) should be considered as first occurance and rest Dupes value with 2, 3, 4... are 2,3,4... occurances
Not sure. just check
Regards John
|
|
|
|
|
I have a reporting Database, which contains monthly metrics, now i want to develop a page in Sharepoint portal, which pulls all records from this reporting database..
Now in Sharepoint portal, User should be able to enter reason for not meeting expectations for that month...
Any suggestions abt how to develop this project would be greatly appreciated.
Sudhie
|
|
|
|
|
I don't know if this is the right section to ask this question
but if someone have some idea i appriciate his help
when i do the wizard step to do the replication this error always occur:
The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "REPLLINK_TELECOPLUS519346055_DATETIMEDA579057684_PUB5-1837106822_EMPTYFORRE236221469" was unable to begin a distributed transaction.<br />
Changed database context to 'emptyForRep'.<br />
OLE DB provider "SQLNCLI" for linked server "REPLLINK_TELECOPLUS519346055_DATETIMEDA579057684_PUB5-1837106822_EMPTYFORRE236221469" returned message "The partner transaction manager has disabled its support for remote/network transactions.". (Microsoft SQL Server, Error: 7391)
Thanks a lot
Assaf
|
|
|
|
|
Hi,
very hard to tell what's going on but can you check if you have a DTC (distributed Transaction Coordinator) enabled on both sides and that both of them can see each other (no firewall in between on ports 4000-4005 and 5000 I think). Microsoft has published some tool called DTCping which can help you proving that DTC works properly on both sides.
|
|
|
|
|
Is there a way to string together a value that is returned by a query wihtout writing function or PLSQL?
Table Def:
ky_remarks
no_remarks_seq
tx_remarks_generic
For instance
select tx_remarks_generic from remarks<br />
where ky_remarks = 232323324<br />
and no_remarks_seq > 0
no_remarks_seq = numeric and allows for multipule lines of remarks.
How can I string all the remarks for that key together in my SQL?
Thanks
Tom
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Tom Wright wrote: Is there a way to string together a value that is returned by a query
well if your talking abt concatinating then in SQL Server u can use the + operator and in ORacle u can use the || operator to concatinate strings
Tom Wright wrote: Tom Wright
tawright915@gmail.c
giving your email likethis is an open invitation for spamers to attack your email!!!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
here is the question:
I want to completely remove t-sql code to oracle code in the project.
For the following code :
SqlCommand cmd = new SqlCommand( m_sqlDeactivateApplication, Connection, Transaction );
cmd.CommandTimeout = 45;
cmd.Parameters.Add( "@ApplicationID", SqlDbType.Int ).Value = AppID;
cmd.Parameters.Add( "@ApplicationProfileID", SqlDbType.Int ).Value = appProfile.ApplicationProfileID;
cmd.Parameters.Add( "@LenderID", SqlDbType.SmallInt ).Value = app.LenderID;
cmd.Parameters.Add( "@NewProductID", SqlDbType.SmallInt ).Value = app.ProductID;
:(what should i do to make it work in pl/sql.
your valuable feedback is appreciated.
thanks,
haseeb
|
|
|
|
|
You will need to change your providor form SQL server to oracle. Your currently using the SQL providor (when you declare a SQLCommand and use SQLDBType you are using the SQL Server specific constants etc. Change to either OLEDB (generic) or better to the oracle providor.
|
|
|
|
|
i have a database of lists of subjects...then in my module, i want to display all the subjects that i recorded in the listbox...
how can i do it? i already connect my dataset in the connection wizard but i can't display it in the listbox.
|
|
|
|
|
if your simply displayin the values of a single column of a DataTable then just make a new bindingSource and fill it with the tableAdapter. Give the bindingSource Name as its DataSource and specify its valueColumn n Display Values from the properties pane if you like.
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
How can i do it? will i make codes for that or will i just set the databindings in the properties of the listbbox?
|
|
|
|
|
ms-help:
chk this address in your MSDN 2005. and whenever u ask questions such as this always specify your application like C# 1.1,2.0, SQL Server 2000 or whatever
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
my MSDN library is not installed...i just borrow the cd
can you just tell me the process, pleassssse!
|
|
|
|
|
do you have yahoo messenger? so we can easily talk about it, this is mine:
pinkaliciouz_rharz@yahoo.com
|
|
|
|
|
For Heaven's Sake! just open the MSDN.com over the web. go to the index and type ListBox COntrol. There will be a section of data binding. Read it and Follow the instrunctions.
These forms are meant to benefit all the people, Thats the way we play the game. You can find a few articles on CP as well. Learn to LURk Before you leap.
Search this same topic in this fforum as well. I'm sure you'll find something useful\
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
|
Hi all,
I keep recieving this error when I try to do an UPDATE on an existing record: [Microsoft][ODBC Driver Manager] Invalid cursor state
I'm making use of Oracle 10g with an ODBC connection. What does it mean and How can I fix it??
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|