April 12, 2012 at 9:37 am
April 12, 2012 at 9:40 am
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 12, 2012 at 9:41 am
suhailtajraja (4/12/2012)
Here is the sample data from table int_aux_favorites.USER_IDTYP_INDENTITY_IDENTITY_SRC_IDDOMAIN_IDENTITY_NMENTITY_TYP_IDAUTO_OPEN_INDMAPI_INDRESERVED1_INDRESERVED2_INDRESERVED3_INDRESERVED4_INDRESERVED5RESERVED6GROUP_ID
065875722User Preferences Information2001NULLNULLNULLNULLNULLNULL0
065963122Co-Client Information2001NULLNULLNULLNULLNULLNULL0
066077522Estate Planning Information2001NULLNULLNULLNULLNULLNULL0
066077822Company Information2001NULLNULLNULLNULLNULLNULL0
066143522Attorney Information2001NULLNULLNULLNULLNULLNULL0
066154322Paralegal Information2001NULLNULLNULLNULLNULLNULL0
15302Estate Planning000NULLNULLNULLNULLNULLNULL0
156022006 Strategic Transaction000NULLNULLNULLNULLNULLNULL0
16-1002022* Send No Marketing Communications900NULLNULLNULLNULLNULLNULL0
16-1001922Former Clients1600NULLNULLNULLNULLNULLNULL0
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.
April 12, 2012 at 9:59 am
I don't understand how to do this in a insert into format. please give explain step by step
thanks
April 12, 2012 at 10:00 am
suhailtajraja (4/12/2012)
I don't understand how to do this in a insert into format. please give explain step by stepthanks
Read the first article I reference below in my signature block.
April 12, 2012 at 10:26 am
dunno if it matches the table that was posted, but here's the data as a select to show what we are looking for:
I've got a pair of macros for hacking strings that people post to turn them into SELECt statements that can be used for INSERT INTO or CTE's:
SELECT '0','6','58757','2','2','User-Preferences-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','59631','2','2','Co-Client-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','60775','2','2','Estate-Planning-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','60778','2','2','Company-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','61435','2','2','Attorney-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','61543','2','2','Paralegal-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','5','3','0','2','Estate-Planning','0','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','5','6','0','2','2006-Strategic-Transaction','0','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','6','-10020','2','2','*-Send-No-Marketing-Communications','9','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','6','-10019','2','2','Former-Clients','16','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0'
Lowell
April 12, 2012 at 10:37 am
The select statements you have made is right. Now what next with it. Do i need to create a sample table to put this into?
thanks
April 12, 2012 at 10:42 am
You already provided that table. Here it is all at once.
CREATE TABLE [dbo].[INT_AUX_FAVORITES](
[USER_ID] [int] NOT NULL,
[TYP_IND] [smallint] NOT NULL,
[ENTITY_ID] [int] NOT NULL,
[ENTITY_SRC_ID] [int] NOT NULL,
[DOMAIN_ID] [int] NOT NULL,
[ENTITY_NM] [nvarchar](150) NOT NULL,
[ENTITY_TYP_ID] [int] NULL,
[AUTO_OPEN_IND] [smallint] NOT NULL,
[MAPI_IND] [smallint] NOT NULL,
[RESERVED1_IND] [int] NULL,
[RESERVED2_IND] [int] NULL,
[RESERVED3_IND] [int] NULL,
[RESERVED4_IND] [int] NULL,
[RESERVED5] [nvarchar](254) NULL,
[RESERVED6] [nvarchar](254) NULL,
[GROUP_ID] [int] NOT NULL,
CONSTRAINT [XPKAUX_FAVORITES] PRIMARY KEY CLUSTERED
(
[USER_ID] ASC,
[TYP_IND] ASC,
[ENTITY_ID] ASC,
[ENTITY_SRC_ID] ASC,
[DOMAIN_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
go
insert INT_AUX_FAVORITES
SELECT '0','6','58757','2','2','User-Preferences-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','59631','2','2','Co-Client-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','60775','2','2','Estate-Planning-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','60778','2','2','Company-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','61435','2','2','Attorney-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '0','6','61543','2','2','Paralegal-Information','20','0','1','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','5','3','0','2','Estate-Planning','0','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','5','6','0','2','2006-Strategic-Transaction','0','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','6','-10020','2','2','*-Send-No-Marketing-Communications','9','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0' UNION ALL
SELECT '1','6','-10019','2','2','Former-Clients','16','0','0','NULL','NULL','NULL','NULL','NULL','NULL','0'
Now we just something similar for all the other tables.
_______________________________________________________________
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 12, 2012 at 11:03 am
the table that i have provided is the actual table. is that needs to be in new temp table so that i dont mess with the actual table? also, what other tables needs to be just like that.
thanks.
April 12, 2012 at 11:05 am
suhailtajraja (4/12/2012)
the table that i have provided is the actual table. is that needs to be in new temp table so that i dont mess with the actual table? also, what other tables needs to be just like that.thanks.
from reading your original query it looks like we need the following tables:
int_aux_project
int_aux_lst_custom
int_user
int_maslon_matter_recent
if you are pulling data from any other tables we will need those to.
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
April 12, 2012 at 11:06 am
suhailtajraja (4/12/2012)
the table that i have provided is the actual table. is that needs to be in new temp table so that i dont mess with the actual table? also, what other tables needs to be just like that.thanks.
All of them. We can't run queries against tables we don't have.
int_maslon_matter_recent
int_aux_project
int_aux_lst_custom
int_aux_lst
int_user
_______________________________________________________________
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 12, 2012 at 1:43 pm
Hi:
I have created all the tables DDL and select data statement. whats next?
thanks.
April 12, 2012 at 1:44 pm
suhailtajraja (4/12/2012)
Hi:I have created all the tables DDL and select data statement. whats next?
thanks.
Post it?
_______________________________________________________________
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 12, 2012 at 2:07 pm
April 12, 2012 at 10:28 pm
Grass (4/12/2012)
Hi Vinu:I checked entity_id,and user_id are retruning multiple records in a table. So, what field do I need in my statement as a distinct.Are these entity_id
,user_id ones? or something else.
Thanks.
This error:
"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
Do you get it only once??.....you can click/double click on it and get to know which part of your code has the error.
Try using "SELECT DISTINCT" or "SELECT 1" in the Subqueries which you think might be causing the error(the subqueries returning entity_id and user_id). This way only one value will be returned and your error will be taken care of.
Hope this helps you.
Please try it and let us know
Viewing 15 posts - 16 through 30 (of 45 total)
You must be logged in to reply to this topic. Login to reply