Extend Table with new query informations
Hi I have the fallowing
#Tabel1
UserName Information1
Information2 Information3
aaaa ab
cv de
bbbb ae
rf cs
dddd et
hh rt
bbbb ze
rt sw
Query
declare @name nvarchar(100)
declare @sql nvarchar(max)
set @name = 'aaaa'
set @sql=
'SELECT * FROM OPENQUERY (
ADSI,
''SELECT
samaccountname,
RBCountryISOCode , Department, company
FROM ''''LDAP://rbeurdom01/DC=rbdom,DC=rbroot,DC=net''''
WHERE
objectClass = ''''user''''
and objectCategory = ''''person''''
and samaccountname = ''''' + @name + '''''
exec dbo.sp_executeSQL @sql
I want an result of #TableReslt with
UserName Information1
Information2 Information3
RBCountryISOCode Department
company
aaaa ab
cv de DE
Market Company1
bbbb ae
rf cs US
Sales Company2
dddd et
hh rt BE
Market Company1
bbbb ze
rt sw US
Sales Company2
How do i do it? Thank you
Something like this i wanted:
Create a procedure from the code that reads data from AD
Create a cursor that goes trough the first table and collect the information.
I did not know about the option to insert type of code..
procedure sp_getADInfo @name nvarchar(100)
declare @nume nvarchar(100)
declare nmsCursor cursor for select distinct nume from #temptbl
open nmsCursor
fetch next from nmsCursor into @nume
WHILE @@FETCH_STATUS = 0
BEGIN
insert into #tblPopulatedFromAD
exec sp_getADInfo @nume
fetch next from nmsCursor into @nume
END
close nmsCursor
deallocate nmsCursor
select * from #temptbl a
left join #tblPopulatedFromAD b
on a.nume = b.displayName
Similar Messages
-
Trying to make an in-app purchase with new account information...purchase would not go thru...told me to contact the iTunes support.
Nobody on these boards can. Click here and ask the iTunes Store staff for assistance.
(101541) -
I was upgrade to SQL Server 2012 and Visual Studio 2010 was upgraded with SP1 the same day. This is x64 machine.
Microsoft SQL Server Management Studio 11.0.2100.60
Microsoft .NET Framework 4.0.30319.261
Operating System 6.1.7601
Problem 1) With SQL Server Management Studio, selecting "New Query" a warning box is displayed: "The 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design.VisualStudioIntegration2010Package, Microsoft.Practices.EnterpriseLibrary.Configuration.Design.VisualStudioIntegration2010,
Version=1.0.0.0, Culture=netutral, PublicKeyToken=null' package did not load correctly. The problem mayhave been cuased by a configuration change or by the installation of another extension. You can get more information by running the
application together with the /log parameter on the command line, and then examining the file ...\AppDate\Roaming\Microsoft\AppEnv\10.0\ActivityLog.xml'. Continue to show this error message?
Problem 2) In a Query Initellisense works intermittently but most of the time it will not display anything. I have tried Edit|Intellisense|Refresh Cach size and also seperately, Edit | Intellisense | List Members but neither has helped. Also
tried different selections for Tools|options| T-SQL | Intellisense| Maximum Script Size; no luck either.Hi WallyJim,
For your first problem, possible workaround:
In Programs and Features (or Add/Remove Programs), right click the Microsoft Enterprise Library 5.0 Optional Update 1 program and select change. Remove the VisualStudio2010 integration.
Then, install the EnterpriseLibrary Configuration extension from Microsoft via the Extension Manager in VS2010. This will allow you to launch the configuration editor from VS2010, but will not be installed for SSMS.
For more information, please refer to
https://connect.microsoft.com/SQLServer/feedback/details/620532/error-message-on-new-query-window-opening.
For your second problem, the following conditions might affect the behavior of IntelliSense:
There is a code error above the cursor.
The insertion point is inside a code comment.
The insertion point is inside a string literal.
The automatic options are turned off.
For more information, refer to Troubleshooting IntelliSense (SQL Server Management Studio):
http://msdn.microsoft.com/en-us/library/ms173434.aspx.
Thanks,
Maggie
Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread. -
How to create a table from an existing table with new column
Hi !
Please help me.
I want to create a table from an existing table with data and add two new column to the new table.
What will be the syntax?craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
if you want to have VARCHAR2 instead of CHAR for example:
SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
Table created.
SQL> desc new_dept
Name Null? Type
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
NEW_COL CHAR(8)
SQL> alter table new_dept modify (new_col varchar2(8));
Table altered.
SQL> desc new_dept
Name Null? Type
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
NEW_COL VARCHAR2(8)Rgds.
Didn't see michael's post - it reflects the fix for this problem using CAST.
Message was edited by:
dnikiforov -
Updating a table with a query that return multiple values
Hi,
I'm trying to update a table which contain these fields : ItemID, InventoryID, total amounts
with a query that return these values itemId, inventoryid and total amounts for each items
Mind you, not all the rows in the table need to be updated. only a few.
This what i wrote but doesn't work since the query return multiple values so i can't assign it to journalAmounts.
UPDATE [bmssa].[etshortagetemp]
SET JournalAmounts = (SELECT sum(b.BomQty) FROM [bmssa].[Bom] b
JOIN [bmssa].[SalesLine] sl ON sl.ItemBomId = b.BomId
JOIN [bmssa].[SalesTable] st ON st.SalesId = sl.SalesId
WHERE st.SalesType = 0 AND (st.SalesStatus IN (0,1,8,12,13)) AND st.DataAreaId = 'sdi'
GROUP BY b.itemid, b.inventdimid)
Any advise how to do this task?Remember that link to the documentation posted above that explains exactly how to do this. When you read it which part exactly were you having trouble with?
-
VK12 - disappered %? how to transport the table with new tax codes?
Hallo
I'm changing conditions for tax codes in VK12. I have 2 questions:
1. When I created new entries, the % sign disappears. What shoud I do with this?
2. Should I create a transport with this changes? Or should I create all new entries with new tax codes manually in all target systems?
Thanks for all help,
Megyhi,
normally tax code changes will be done in PRD directly.
no need to transport
in VK12, that is change condtion record, you will find the details of condition record right.
then why are you going to create again.
change what ever you want to change then and there only and proceed with your requriment.
regards,
balajia -
Problem when updating af:table with new records
Hi,
I have a page that shows two tables from the same DB table but with different VOs.
Table1 displays records where date_column is within the current month, table2 displays all records.
The problem is that when I add new record and return to the page, I find out that the new record has been added to both tables, it’s shown in table1 even though its date is not within this month.
When I run the page again the problem is solved and everything is in the right place !!
How can I fix this?Hi,
you will have to re-query the iterators because you add the new row to a VO - which is an iterator - that wont filter your input (instead you add to a filtered iterator). However, its strange that both tables show that value because if these are different VO they should be independent. Only if they are instances of the same VO tehy are expected to show the same data
Frank -
Join two tables with the same information
I have a registration database. It references two other tables. I accept registrations from Faculty and from Students, but their information is in two different tables. Both have fname and lname. If they have people_id filled in, I want the fname and lname from the People table. If they have student_id filled in, I want it from the Student table.
I've never done this sort of IF situation. Here are the tables:
create table passport_registration (
passport_registration_id NUMBER Primary Key,
date_added date,
student_id NUMBER REFERENCES students(student_id),
people_id NUMBER REFERENCES people(id),
passport_listing_id NUMBER REFERENCES passport_listing(passport_listing_id)
create table PEOPLE (
id NUMBER Primary Key,
dateModified date,
fname VARCHAR2(100),
lname VARCHAR2(100)
create table students (
student_id NUMBER Primary Key,
date_added date,
s_uid VARCHAR2(50),
fname VARCHAR2(50),
lname VARCHAR2(50)
Any sort of assistance is appreciated.
Thank you.
daniel(It'd be helpful if you could edit your post and stick {noformat} before and after your sql statement - that will format it so that the (+){noformat} show correctly instead of being converted to the (+) symbol!)
As to the questions:
1. You've got two columns that have a decision to be made on them; you're going to need to write two sets of decision-making code, one for each column. I guess you could also do something like:select a.col1, d.col2, d.col3
from table1 a, (select 'table2' cola, b.col1, b.col2, b.col3 from table2 b
union all
select 'table3' cola, c.col1, c.col2, c.col3 from table3 c) d
where a.col1 = d.col1
and nvl2(a.col2, 'table3', 'table2') = d.cola;
nb, not tested, and I'm up far too late, so could have made an easy mistake!
2. Yes, {noformat} (+){noformat} is the oracle method of doing outer joins; it could be rewritten into ansi joins if you like; I'm just not that familiar with them to do it myself! -
Fetch data from 50 tables with single query
Hi,
I am having a requirement where I should fetch the records count in a table, since there are close to 50 tables I have written below code, which is working fine with out WHERE clause, but going to short dump if I use a where clause.
IF NOT p_sel_opt IS INITIAL.
LOOP AT p_sel_opt INTO wa_sel_opt .
ASSIGN wa_sel_opt-low TO <fval>.
ASSIGN p_fieldname TO <field>.
IF <field> IS ASSIGNED AND <fval> IS ASSIGNED.
SELECT COUNT(*) FROM (p_tabname) WHERE <FIELD> = <fval> .
IF sy-subrc = 0.
wa_fi_bukrs-bukrs = <fval>.
wa_fi_bukrs-table = p_tabname.
wa_fi_bukrs-count = sy-dbcnt.
APPEND wa_fi_bukrs TO it_fi_bukrs.
CLEAR wa_fi_bukrs.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Reason it is giving is
<field>
is not availble in the data base tables . what can I do to the above query for that to work.
Thanks,
Varunreplace <field> with (<field>) ok?
but, its better if you construct your where clause.. i dont know the above will work or not.
like
concatenate <FIELD> ' = ' <fval> into s1 separated by space.
and pass where (s1).
check the FM RFC_READ_TABLE. you will get a proper picture
Edited by: Soumyaprakash Mishra on Dec 13, 2011 11:02 PM -
Extending EcoreTools with new EAnnotation-based layers
Hi everyone,
I am working on an application based on an Ecore model heavily using EMF annotations (EAnnotation), as the former versions of this model were UML models using stereotypes. The people in charge of the model would like to be able to edit these annotations directly from the Ecore editor.
I would like to add extra layers to the EcoreTools editor, such as the Documentation or Constraint layer but with my own annotation names.
What would be the best way to achieve this ?
* Is there an EcoreTools extension point enabling to add such extensions ?
* Is it better to extend EcoreTools's VSM in my own .odesign file, which would be used for Ecore visualisation/edition ?
* Another way ?
Thanks in advance for your replies,
FrançoisHi,
you can define an extension which can contribute a Layer (with Mappings) and Tools through another plugin (use the Viewpoint Specification Project wizard to create it).
Almost everything happens in the .odesign file, name your Group, Viewpoint then a DiagramExtension which can specify the contributed layers and mappings.
Once this is done, a user has to explicitely enable your Viewpoint (and might have to enable your layer -- depending on the default enablement status of your layer) the EcoreTools diagram editor will then adapt its behavior.
There is an example of that in ecore.odesign with the "Archetype" Viewpoint which adds style customizations and new tools. You can do the same from another plugin. -
Transparent Table with Invoicing Plan Information
Hello,
I just want to know what transparent table have the Invoicing Plan Information from a Line Item.
Regards,
HectorThanks for your reply.
I also used FPLT.
Regards,
Hector -
Create new table with new calculated entries
Hi,
I got a little problem.
I have a table which includes the vacations times of employees. The vacation time was periodic ,so I split them in to days. Now I want to calculate the exact days.Sometimes there are weekends included which I have to subtract. I flaged every day, that I exactly know which day is a working day and which one isn't. Is there a way that I only sum the working days without the weekends?
Table Vacation_Times:
Empl --- V_Start_D --- V_End_D --- Date --- Days --- D_Name
Mr.A --- 01.05.11 --- 06.05.11 --- 01.05.11 --- 6 --- Wednesday
Mr-A --- 01.05.11 --- 06.06.11 --- 02.05.11 --- 6 --- Thursday
Mr.A --- 01.05.11 --- 06.05.11 --- 03.05.11 --- 6 --- Friday
Mr-A --- 01.05.11 --- 06.06.11 --- 04.05.11 --- 6 --- Saturday
Mr.A --- 01.05.11 --- 06.05.11 --- 05.05.11 --- 6 --- Sunday
Mr-A --- 01.05.11 --- 06.06.11 --- 06.05.11 --- 6 --- Monday
NEW table:
Empl --- V_Start_D --- V_End_D --- Date --- Days --- D_Name --- Actual_Days
Mr.A --- 01.05.11 --- 06.05.11 --- 01.05.11 --- 6 --- Wednesday --- 4
Mr-A --- 01.05.11 --- 06.06.11 --- 02.05.11 --- 6 --- Thursday --- 4
Mr.A --- 01.05.11 --- 06.05.11 --- 03.05.11 --- 6 --- Friday --- 4
Mr-A --- 01.05.11 --- 06.06.11 --- 04.05.11 --- 6 --- Saturday --- 4
Mr.A --- 01.05.11 --- 06.05.11 --- 05.05.11 --- 6 --- Sunday --- 4
Mr-A --- 01.05.11 --- 06.06.11 --- 06.05.11 --- 6 --- Monday --- 4
thxHi,
try
SELECT Empl ,V_Start_D ,V_End_D ,Date ,Days ,D_Name , count(*) as Actual_Days
FROM vacation v
JOIN datelist d ON d.day between V_Start_D and V_End_D and d.is_working_day='Y'
GROUP BY Empl ,V_Start_D ,V_End_D ,Date ,Days ,D_Name Regards,
Carsten. -
Dynamically fill the internal table with new fileds
Hi Friends,
I have the internal table like
Data:begin of i_data occurs 0,
a(60),
b(60),
c(60),
d(60),
e(60),
end of i_data.
I need to fill the internal table dynamically like
Data:begin of i_data occurs 0,
a(60),
b(60),
c(60),
c1(60), "new filed dynamically
c2(60), "new field dynamically
d(60),
e(60),
end of i_data.
Please suggest me how to do this.
Regards,
Sunny.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 1:55 PMYou can not add new fields to a statically defined internal table, instead you must create the entrie internal table at runtime.
Search this forum for Dynamic Internal tables, you will get a lot of example programs.
Regards,
Rich Heilman -
Hi,
I'm trying to learn JSP custom Tags.
I'm using JDK 1.6
Eclipse 1.2.1
Tomcat 6.0
I have added the External JAR "servlet-api.jar" from Tomcat6.0/lib.
I'm trying to create the following HelloWorldTag.java in a "Dynamic Web Project" in Eclipse in a package com.jspservlet.
It is showing a complie error as "*The import javax.servlet.jsp.tagext cannot be resolved."*
Could you please help me in solving my problem*.*
package examples.taglibs;
import javax.servlet.jsp.tagext.;
import javax.servlet.jsp.;
import java.io.;
public class HelloWorldTag extends TagSupport
public int doStartTag()
throws JspException, IOException
JspWriter out = pageContext.getOut();
out.println("<h1>Hello World!</h1>");
return SKIP_BODY;
public int doEndTag()
return EVAL_PAGE;
Thanks in Advance.First, please use the 'code' button when posting. Second, your imports are wrong. You need to import javax.servlet.jsp.tagext.* (and the same for your other package imports). Finally, if you still cannot find the relevant class (once the imports are fixed), then download it at http://www.docjar.com/jar_detail/jsp-api-2.0.jar.html
- Saish -
How to fill a table with a query?
Hi experts,
J'ai une table que je veux remplir avec ma requête. J'ai aussi un bouton sur lequel je veux cliquer pour exécuter ma requête et afficher le résultat dans le tableau. Quelqu'un peut il m'aider?
Regards.oDBs_Detail1 = oForm.DataSources.DBDataSources.Item("@HIS_OPDINVD")
oDBs_Head = oForm.DataSources.DBDataSources.Item("@HIS_OPDINVH")
Dim oRS As SAPbobsCOM.Recordset
oRS = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim Str1 As String
Str1 = "Select T3.U_Qty,T3.U_PList,T3.U_TLName,T3.U_TLID, T3.U_TLPrice from [@UPDATE] T0,[@UPDATE4] T3"
Str1 = Str1 & " where T0.DocEntry = T3.DocEntry"
Str1 = Str1 & " and T0.U_PID='" & PID & "' and U_VisitID='" & VisitID & "' and T3.U_TLID IS NOT NULL "
oRS.DoQuery(Str1)
For i As Integer = 1 To oRS.RecordCount
oBillMat.AddRow()
oBillMat.FlushToDataSource()
oDBs_Detail1.Offset = i
Total = oRS.Fields.Item("U_TLPrice").Value
oDBs_Detail1.SetValue("LineID", oDBs_Detail1.Offset, i)
oDBs_Detail1.SetValue("U_SID", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLID").Value)
oDBs_Detail1.SetValue("U_Price", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLPrice").Value)
oDBs_Detail1.SetValue("U_Desc", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLName").Value)
oDBs_Detail1.SetValue("U_PL", oDBs_Detail1.Offset, oRS.Fields.Item("U_PList").Value)
oDBs_Detail1.SetValue("U_TB", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLPrice").Value)
oDBs_Detail1.SetValue("U_Qty", oDBs_Detail1.Offset, oRS.Fields.Item("U_Qty").Value)
oBillMat.SetLineData(i)
oBillMat.FlushToDataSource()
oRS.MoveNext()
Next
Maybe you are looking for
-
Open file in main vi, write in subvi and close in mainvi
Hi, Im opening a file in the main vi , passing the reference number to the write to text file which is located in the subvi and passing the refnum out from this vi to the main vi again to close the file. But, I always have only the last value of the
-
BInput Data mismatch with currency format
i am working with fs10 transaction I want to sum up the balance amount with respect to all companycode and post SUM to the bseg table using Batch input. i defined sum variable as below and coded. data : sum like glt0-hsl01. (currency format) After a
-
Adding background image to JTextPane??
how to do that? thanks in advance....
-
Why does Safari keep crashing on me?
I have read a number of other threads of other people who have this problem, but I can't seem to make it stop. It always crashes while using the FlashPlayer 10.6 plugin. Here is the message I get: Process: Safari [1013] Path: /Appl
-
IPad resets every time I get to end of photos
Anyone know what the heck is going on here ? I deleted a few photos that I thought were causing this bit no luck. I heard quite a few people had the same problem, so their seems to be a glitch In the software. The iPad works perfect except for the vi