Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Need Help with the Error 'Subquery returned more than 1 value'.


Need Help with the Error 'Subquery returned more than 1 value'.

Author
Message
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24167 Visits: 37929
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.

Cool
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)
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16540 Visits: 16993
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)
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16540 Visits: 16993
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)
Grass
Grass
SSC Rookie
SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)

Group: General Forum Members
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.
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16540 Visits: 16993
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)
Grass
Grass
SSC Rookie
SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)

Group: General Forum Members
Points: 45 Visits: 342
[code="plain"][/code]
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16540 Visits: 16993
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)
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24167 Visits: 37929
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.

Cool
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)
Grass
Grass
SSC Rookie
SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)

Group: General Forum Members
Points: 45 Visits: 342
I don't understand how to do this in a insert into format. please give explain step by step

thanks
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24167 Visits: 37929
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.

Cool
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)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search