Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Need Help with the Error 'Subquery returned more than 1 value'. Expand / Collapse
Author
Message
Posted Thursday, April 12, 2012 8:34 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:24 PM
Points: 20,739, Visits: 32,526
suhailtajraja (4/12/2012)
Sorry,

Don't understand what is DDL means and what data you need to see, the table that used in the select statement.

thanks


DDL - Data Defintion Language. In this case it means the CREATE TABLE statements used to create the tables.

Data - Sample data for the table(s) that you provide the DDL for. The sample data needs to be provided in a readily consumable format, a series of INSERT INTO statements usually works best.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1282425
Posted Thursday, April 12, 2012 8:47 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:04 PM
Points: 13,086, Visits: 12,553
I can pretty much guarantee there is no need for a cursor for this. This is nothing more than a delete statement inside a loop. This can pretty easily be converted to a single delete statement. Once you post the ddl and some sample data we can knock this out pretty quick.



_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1282446
Posted Thursday, April 12, 2012 9:00 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:04 PM
Points: 13,086, Visits: 12,553
this is just a shot in the dark but I assume you passing in @Matter_ID and @Project_ID?

See if this select would get all int_aux_favorites that you want deleted for a given matter_ID and Project_ID.

select iaf.* 
from int_maslon_matter_recent immr
join int_aux_project iap on iap.project_cd = immr.MatterNumber
join int_aux_lst_custom ialc on immr.TimeKeeperNumber = ialc.string_value and LST_CUSTOM_DEF_ID = '-10017'
join int_user iu on iu.listing_id = ialc.listing_id
join int_aux_favorites iaf on iaf.user_id = iu.user_id and iaf.entity_id = iap.project_id
where immr.entity_id = @Project_ID
and immr.MatterNumber = @Matter_ID



_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1282459
Posted Thursday, April 12, 2012 9:14 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:59 AM
Points: 45, Visits: 342
Thanks for the reply. I will try this. Which part of the code needs to be replaced for this the code you provided.

Post #1282483
Posted Thursday, April 12, 2012 9:35 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:04 PM
Points: 13,086, Visits: 12,553
There are far more tables than just the favorites. Also, we need sample data for each table.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1282506
Posted Thursday, April 12, 2012 9:37 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:59 AM
Points: 45, Visits: 342
[code="plain"][/code]
Post #1282510
Posted Thursday, April 12, 2012 9:40 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:04 PM
Points: 13,086, Visits: 12,553
Posting them as insert statements would be the preferred method. That way the people offering to help get your data in an easily consumable format.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1282515
Posted Thursday, April 12, 2012 9:41 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:24 PM
Points: 20,739, Visits: 32,526
suhailtajraja (4/12/2012)
Here is the sample data from table int_aux_favorites.


USER_ID TYP_IND ENTITY_ID ENTITY_SRC_ID DOMAIN_ID ENTITY_NM ENTITY_TYP_ID AUTO_OPEN_IND MAPI_IND RESERVED1_IND RESERVED2_IND RESERVED3_IND RESERVED4_IND RESERVED5 RESERVED6 GROUP_ID
0 6 58757 2 2 User Preferences Information 20 0 1 NULL NULL NULL NULL NULL NULL 0
0 6 59631 2 2 Co-Client Information 20 0 1 NULL NULL NULL NULL NULL NULL 0
0 6 60775 2 2 Estate Planning Information 20 0 1 NULL NULL NULL NULL NULL NULL 0
0 6 60778 2 2 Company Information 20 0 1 NULL NULL NULL NULL NULL NULL 0
0 6 61435 2 2 Attorney Information 20 0 1 NULL NULL NULL NULL NULL NULL 0
0 6 61543 2 2 Paralegal Information 20 0 1 NULL NULL NULL NULL NULL NULL 0
1 5 3 0 2 Estate Planning 0 0 0 NULL NULL NULL NULL NULL NULL 0
1 5 6 0 2 2006 Strategic Transaction 0 0 0 NULL NULL NULL NULL NULL NULL 0
1 6 -10020 2 2 * Send No Marketing Communications 9 0 0 NULL NULL NULL NULL NULL NULL 0
1 6 -10019 2 2 Former Clients 16 0 0 NULL NULL NULL NULL NULL NULL 0




I don't see how we can geet this data into the table you provided. This needs to be in a readily consumable format, such as a series of INSERT INTO statements.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1282516
Posted Thursday, April 12, 2012 9:59 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:59 AM
Points: 45, Visits: 342
I don't understand how to do this in a insert into format. please give explain step by step

thanks
Post #1282535
Posted Thursday, April 12, 2012 10:00 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:24 PM
Points: 20,739, Visits: 32,526
suhailtajraja (4/12/2012)
I don't understand how to do this in a insert into format. please give explain step by step

thanks


Read the first article I reference below in my signature block.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1282537
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse