Native SQL Update statement error when more than one field used
Hi, I would make it simple. I update directly to a SQL server.
1-
When I update only one field works.
LOOP AT IT_MAT.
EXEC SQL.
UPDATE Articulos SET PrecioSinImp = :IT_MAT-PRECIOSINIMP WHERE Modelo = :IT_MAT-MODELO
ENDEXEC.
ENDLOOP.
This give me sy-subrc = 0
When I Try to update several fields doesnt works, any would can help me ?.
LOOP AT IT_MAT.
EXEC SQL.
UPDATE Articulos SET PrecioSinImp = :IT_MAT-PRECIOSINIMP
Descripcion = :IT_MAT-DESCRIPCION
WHERE Modelo = :IT_MAT-MODELO
ENDEXEC.
ENDLOOP.
This give me dump SQL error 170.
2- BTW, I have to leave this report program in a job so the data would be updated once a day in a job, so I have to update the existing data and add new one.
I Was thinking doing something like this.
LOOP AT it_table.
UPDATE DQL TABLE
IF sy-subrc <> 0.
INSERT DQL TABLE
ENDIF.
ENDLOOP.
This may works ??? because if this not work, I have to select single each one of the data in the SQL table, if it was founded UPDATE otherwise INSERT. And I dont like this aproach.
Thx
Hi Rodrigo,
I feel that your requirement is as below:
Depending on the criteria in the where clause, check whether the record exists or not.. If it does, then update the record with new values, else, create a new record..
You can do the same as below:
LOOP AT it_mat INTO e_mat. (e_mat of same structure as it_mat)
MOVE : xxx TO e_mat-yyy... and so on (Only change the non-key values)
MODIFY dbtable FROM e_mat.
ENDLOOP.
This code will create a new record if a record with the given key values in e_mat is not found, else, it will update the existing record with the new non-key values in the structure e_mat.
Thanks and Best Regards,
Vikas Bittera.
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
Similar Messages
-
Dynamically populating more than one field using xml data binding
Hi All,<br /><br />I have the following code that works fine to dynaically populate a<br />second drop-down list2 from a choice in drop-down list1 using xml data<br />biding.<br /><br />var tempString = "xfa.record." + this.boundItem(xfa.event.newText);<br />var oItems = xfa.resolveNode(tempString);<br />var nItemsLength = oItems.nodes.length;<br /><br />myinfo.page1.state.clearItems();<br />myinfo.page1.state.rawValue = null;<br /><br />for (var nItemCount = 0; nItemCount < nItemsLength; nItemCount++)<br />{<br />myinfo.page1.state.addItem(oItems.nodes.item(nItemCount).value);<br />}<br /><br />Here is my xml file<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><myinfo><br /><country/><br /><countries><br /><item uiname="United States" token="US"/><br /><item uiname="South Africa" token="SA"/><br /><item uiname="Australia" token="AU"/><br /></countries><br /><state/><br /><AU><br /><item>Australian Capital Territory</item><br /><item>New South Wales</item><br /><item>Northern Territory</item><br /><item>Queensland</item><br /><item>South Australia</item><br /><item>Tasmania</item><br /><item>Victoria</item><br /><item>Western Australia</item><br /></AU><br /><US><br /><item>California</item><br /><item>New York</item><br /><item>Texas</item><br /><item>Michigan</item><br /><item>North Carolina</item><br /><item>South Carolina</item><br /></US><br /><SA><br /><item>Eastern Cape</item><br /><item>Free State</item><br /><item>Gauteng</item><br /><item>KwaZulu-Natal</item><br /><item>Limpopo</item><br /><item>Mpumalanga</item><br /><item>Northern Cape</item><br /><item>North-West</item><br /><item>Western Cape</item><br /></SA><br /></myinfo><br /><br />I have two questions:<br /><br />1) I want to be able to structure my xml in a way that I can populate<br />a third drop-down list3 from a choice in list2. I need to know how to<br />to include the different capital cities of the states in my xml data<br />so that they can get populated in list3 from a selection in list2;<br /><br />2) And be able to script the third list3 to get dynamically populated<br />from a choice in list2.<br /><br />Thanks in advance for your help.
I would like to ask someone for help.
I have an XML file a result of the XSLT transformation. A schema was created based on this XML and this schema is bound to a form as a data source. When I preview my form using a Preview tab with transformed XML as a Data File in LiveCycle Designer 8.1, I can see only the first form data across 3 Text fields on the form. The rest of the forms are not getting displayed. What am I doing wrong?
Here is the part of the XML file Im trying to display on the form:
FORM 1
FORM 1 DESCRIPTION
$5000
FORM 2
FORM 2 DESCRIPTION
$7000
FORM 3
FORM 3 DESCRIPTION
$4000
Part of the schema that was created based on the XML file from above:
Thank you. -
Revision: 4916
Author: [email protected]
Date: 2009-02-10 13:32:12 -0800 (Tue, 10 Feb 2009)
Log Message:
sdk-14180 Handle updates to more than one field in an item when autoupdates are off.
QE Notes: None
Doc Notes: None
Bugs: sdk-14180
Reviewer: ryan
tests: checkintests mustella:collections
Ticket Links:
http://bugs.adobe.com/jira/browse/sdk-14180
http://bugs.adobe.com/jira/browse/sdk-14180
Modified Paths:
flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/collections/ListCollectionView .asRevision: 4916
Author: [email protected]
Date: 2009-02-10 13:32:12 -0800 (Tue, 10 Feb 2009)
Log Message:
sdk-14180 Handle updates to more than one field in an item when autoupdates are off.
QE Notes: None
Doc Notes: None
Bugs: sdk-14180
Reviewer: ryan
tests: checkintests mustella:collections
Ticket Links:
http://bugs.adobe.com/jira/browse/sdk-14180
http://bugs.adobe.com/jira/browse/sdk-14180
Modified Paths:
flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/collections/ListCollectionView .as -
I am using mutiple select queries to fetch data from Project Server 2010 DB(its sharepoint DB) and these queries fetch data in Excel BI report by establishing connection with DB using instance name and all. I have enhance all these select queries and data
is being fetched in secs. but when more than one copy of same Excel BI report is refreshed using 'Refresh All' option, then these select queries cause blockage on DB.
Please let me know mitigation for this blockage issue.
Should I use begin transaction and commit transaction statements/ shared lock statements.
please replyHi,
run same query at the same time? -
When designing, how do I copy more than one field at a time?
How do I copy more than one field at a time?
Hi,
You can use the Ctrl or Shift modifier keys to select multiple form items. Ctrl+click toggles the selected state of the item. Shift+click selects a range of form items.
Regards,
Brian -
Hotspot on more than one fields in ALV Report
I want to add Hotspot on more than one field in ALV,
one field is Vbeln , one is BSTNK, one is matnr and so on.
i have used form user_command.and have written coding for Vbeln (on vbeln i am showing transaction VA02)
i want to pass an eror mesaage when user clicks on bstnk or matnr.
ThanksHi Lovleen,
*Global definitions *
Data Types
type-pools: slis.
types: begin of tp_data,
ebeln like ekko-ebeln,
*matnr like ekko-matnr,
*meins like ekko-meins,
lifnr like lfa1-lifnr,
chk1,
end of tp_data,
tp_tbl_data type standard table of tp_data.
Constants
Data objects (variable declarations and definitions)
Report data to be shown.
data: it_data type standard table of tp_data.
Heading of the report.
data: t_heading type slis_t_listheader.
======================= Selection Screen ==========================
selection-screen: begin of block b1 with frame title text-t01.
DATA: w_aux_ebeln like ekko-ebeln.
SELECT-OPTIONS s_ebeln for w_aux_ebeln
DEFAULT 1000 .
DATA: w_aux_lifnr like lfa1-lifnr.
SELECT-OPTIONS s_lifnr for w_aux_lifnr
DEFAULT 00000001000 .
selection-screen: end of block b1.
======================== Event Blocks =============================
at selection-screen.
start-of-selection.
perform get_data using it_data.
end-of-selection.
perform build_alv using it_data t_heading.
======================== Subroutines ==============================
*& Form get_data
Gets the information to be shown in the report.
form get_data using t_data type tp_tbl_data.
SELECT e~ebeln
*e~matnr
*e~meins
l~lifnr
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM ekko as e
inner join lfa1 as l on elifnr = llifnr
WHERE e~ebeln in s_ebeln
AND l~lifnr in s_lifnr
endform. " get_data
*& Form build_alv
Builds and display the ALV Grid.
form build_alv using t_data type tp_tbl_data
t_heading type slis_t_listheader.
ALV required data objects.
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
Field Catalog
perform set_fieldcat2 using:
1 'CHK1' 'XFELD' space space space 'Select' 'Select this row' 'Sel'
'Select this row' space space space 'X' 'X' space t_fieldcat,
2 'EBELN' 'EBELN' 'EKKO' space space space space space space space
space space space space space t_fieldcat ,
3 'MATNR' 'MATNR' 'EKKO' space space space space space space space
space space space space space t_fieldcat ,
4 'MEINS' 'MEINS' 'EKKO' space space space space space space space
space space space space space t_fieldcat ,
5 'LIFNR' 'LIFNR' 'LFA1' space space space space space space space
space space space space space t_fieldcat .
Layout
x_layout-zebra = 'X'.
Top of page heading
perform set_top_page_heading using t_heading t_event.
Events
perform set_events using t_event.
GUI Status
w_status = ''.
w_repid = sy-repid.
Title
w_title = <<If you want to set a title for
the ALV, please, uncomment and edit this line>>.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = t_data
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = ''(001).
append x_heading to t_heading.
Program name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Program: '.
x_heading-info = sy-repid.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
endform.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-up = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
p_colpos: Column position.
p_fieldname: Field of internal table which is being described by
* this record of the field catalog.
p_ref_fieldname: (Optional) Table field / data element which
* describes the properties of the field.
* If this field is not given, it is copied from
* the fieldname.
p_ref_tabname: (Optional) Table which holds the field referenced
* by <<p_ref_fieldname>>.
If this is not given, the parameter
<<p_ref_fieldname>> references a data element.
p_outputlen: (Optional) Column width.
p_noout: (Optional) If set to 'X', states that the field is not
* showed initially. If so, the field has to be
included in the report at runtime using the display
options.
p_seltext_m: (Optional) Medium label to be used as column header.
p_seltext_l: (Optional) Long label to be used as column header.
p_seltext_s: (Optional) Small label to be used as column header.
p_reptext_ddic: (Optional) Extra small (heading) label to be
* used as column header.
p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
or REPTEXT_DDIC as text for column header.
p_hotspot: (Optional) If set to 'X', this field will be used
* as a hotspot area for cursor, alolowing the user
* to click on the field.
p_showasicon: (Optional) If set to 'X', this field will be shown
as an icon and the contents of the field will set
* which icon to show.
p_checkbox: (Optional) If set to 'X', this field will be shown
as a checkbox.
p_edit: (Optional) If set to 'X', this field will be editable.
p_dosum: (Optional) If set to 'X', this field will be summed
(aggregation function) according to the grouping set
by the order functions.
t_fieldcat: Table which contains the whole fieldcat.
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given
is a data element.
If p_ref_tabname is given, the ref_fieldname given is a
field of a table.
In case ref_fieldname is not given,
it is copied from the fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = <<If you want to set a logo, please,
uncomment and edit this line>>
it_list_commentary = t_heading.
endform. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
Example Code
Executes a command considering the sy-ucomm.
CASE r_ucomm.
WHEN '&IC1'.
Set your "double click action" response here.
Example code: Create and display a status message.
DATA: w_msg TYPE string,
w_row(4) TYPE n.
w_row = rs_selfield-tabindex.
CONCATENATE 'You have clicked row' w_row
'field' rs_selfield-fieldname
'with value' rs_selfield-value
INTO w_msg SEPARATED BY space.
MESSAGE w_msg TYPE 'S'.
ENDCASE.
End of example code.
endform. "user_command
Reward Points if useful.
Regards,
Manoj Kumar -
NetBeans VWP: help w/ AJAX, is it possible to refresh more than one field?
I have a form with lots of fields. Some of them the value is retrieved from the database, for example the service field, where the user types the service id and at the onChange event the form is submitted, executing the processValueChange handler. In this handler the service data is retrieved from the database and a static text with the service name and a static text with the service price are updated.
I'm trying to do this with AJAX, so at the onChange event of the service id text field I have the following:
document.getElementById('form1:stServiceName').refresh('form1:tfServiceId');
document.getElementById('form1:stServicePrice').refresh('form1:tfServiceId');It works, but the processValueChange handler is executed 2 times, and that's a problem...
Isn't there any way to refresh more than one field? With something like this for example:
document.getElementById('form1:tfServiceId').submit();
document.getElementById('form1:stServiceName').refresh();
document.getElementById('form1:stServicePrice').refresh();Thanks for any help,
FelipeYou may want to try creating your own custom popup lov
http://www.oracle.com/technology/products/database/application_express/howtos/how_to_create_custom_popups.html
you can then create your own lov report listing all people and then when you click the name required you can passback as many values as required to the calling form. -
Dynamic Filter SAP HANA - For more than one field
Hi Guys,
Is their any way we can apply filter for more than one field. Lets take below example i want to apply filter both on PERNR & DOJ. I am able to apply filter on PERNR but when i try to create filter on more than one field (PERNR & DOJ ) it throws me some error.
Please let me know how we can achieve this.
OUT_EMP_SAL = SELECT A.PERNR, A.DOJ, A.FNAME, B.SALARY FROM "SAPH74".EMP_INFO A
INNER JOIN "SAPH74".EMP_SAL B
ON A.PERNR = B.PERNR;
OUT_EMP_SAP = APPLY_FILTER(:OUT_EMP_SAL, :IN_PERNR )Hi Lakshmi,
You may need to use the end while calling, i took the same example from the "Help" in hana.
CREATE PROCEDURE GET_PROCEDURE_NAME (IN filter NVARCHAR(100), OUT procedures outtype)
AS
BEGIN
temp_procedures = SELECT SCHEMA_NAME, PROCEDURE_NAME FROM SYS.PROCEDURES;
procedures = APPLY_FILTER(:temp_procedures,:filter);
END;
CALL GET_PROCEDURE_NAME(' SCHEMA_NAME = ''SYS'' AND PROCEDURE_NAME like ''TREX%''', ?);
Regards,
Krishna Tangudu -
More than one user "using an expression" in a BPM Task
Hello,
I want to send a notification step for multiple users. I see two options
1. Choose one or more UME principals.
2. Use an expression.
However I have to send the notification for more than one user using an expression. I'm using this expression,
getPrincipal(DO_xyz)
but this only works for one user. I need something like this
getPrincipal(DO_xyz); getPrincipal(DO_xyz2); getPrincipal(DO_xyz3)
But this is not possible. I can't use a group because all this information is dynamic and it's born within the process.
Please, How can I solve this?
Best Regards
SUHello Abhijeet,
I've seen that I can use the getPrincipals adding in the XSD an string with 1..* cardinality. However I don't know how to map an attribute from the UITask to that new attribute in the XSD because in Web Dynpro I can't create an string with cardinality 1..*
I've tried to create a node (1..*) with a String inside in the UI but I couldn't map it to the process context, it shows me an error that I cannot map a node to a String.
Thanks
Regards
SU -
At Line-selection in ALV for more than one field.
How to use At Line-selection in ALV Basic Report where there are more than one field for displaying Secondary Lists.
Ex: In Basic List there are 3 fields Volume_m Volume_y and Volume_i.When i click on any of the field i need to display the secondary list for that particular field.Hi Pavan,
Use User-command event of ALV.
Refer this code :
form BUILD_EVENTCAT using p_i_eventcat TYPE SLIS_T_EVENT.
DATA: I_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_I_EVENTCAT
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear I_event.
read table p_i_eventcat with key name = slis_ev_user_command into I_event.
if sy-subrc = 0.
move 'USER_COMMAND' to I_event-form.
append I_event to p_i_eventcat.
endif.
form USER_COMMAND' using p_ucomm type sy-ucomm
p_selfield type slis_selfield.
case p_ucomm.
WHEN '&IC1'. "&IC1 is the Fcode for double click
Use P_ELFIELD-VALUE for further processing . this will contain the value on which u will double click
endcase.
Reward points if helpful.
Regards,
Hemant -
How do u save datas more than one table using net beans ide using JSF
Hi,
I am new to JSF.
I save / delete / update / New master table using POJO (Plain Old Java Objects), database - oracle and Toplink Persistence Unit.
How do u save data more than one table using net beans ide using JSF (I am using POJO) ?
and also Tell me the reference book for JSF.
Thanks in advance.
regards,
N.P.SivaSivaNellai wrote:
I am new to JSF.
So, I am using net beans IDE 6.1 from sun microsystem. It is a free software.No, you don't drag'n'drop if you're new to JSF. Switch to source code mode. Write code manually, with the help of IDE for the speed up.
So, please guide me the reference books, articles. I need the basic understanding of JSF, net beans IDE.[JSF: The Complete Reference|http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400] is a good book. The [JSF specification document|http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] is also a good reading to understand what JSF is and how it works. There are also javadocs and tlddocs of Sun JSF Mojarra. -
How to backup more than one database using powershell
I am Trying to backup more than one database using the following script but no luck. I want user to type on command line the database they want to backup, e.g all databases that have "test" at the front like test.inventory, test.sales so i want
user to type test.* and it backs up all databases related to test. Here is the script
#$date = Get-Date -Format yyyyMMddHHmmss
#$dbname = 'test.inventory'
$dbToBackup = "test.inventory"
cls
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") |
Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")
| Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-
Null
Add-Type -AssemblyName "Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91"
$server = New-Object Microsoft.SqlServer.Management.Smo.Server($env:ComputerName)
$server.Properties["BackupDirectory"].Value = "C:\_DBbackups"
$server.Alter()
$backupDirectory = $server.Settings.BackupDirectory
#display default backup directory
"Default Backup Directory: " + $backupDirectory
$db = $server.Databases[$dbToBackup]
$dbName = $db.Name
$timestamp = Get-Date -format yyyyMMddHHmmss
$smoBackup = New-Object ("Microsoft.SqlServer.Management.Smo.Backup")
#BackupActionType specifies the type of backup.
#Options are Database, Files, Log
#This belongs in Microsoft.SqlServer.SmoExtended assembly
$smoBackup.Action = "Database"
$smoBackup.BackupSetDescription = "Full Backup of " + $dbName
$smoBackup.BackupSetName = $dbName + " Backup"
$smoBackup.Database = $dbName
$smoBackup.MediaDescription = "Disk"
$smoBackup.Devices.AddDevice($backupDirectory + "\" + $dbName + "_" + $timestamp +
".bak", "File")
$smoBackup.SqlBackup($server)
#let's confirm, let's list list all backup files
$directory = Get-ChildItem $backupDirectory
$backupFilesList = $directory | where {$_.extension -eq ".bak"}
$backupFilesList | Format-Table Name, LastWriteTimeOr i am using this script which backs up everything except tempdb but dont know how to modify this so that it backs up up all test related databases
Is there a way that i use test.*
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$s = new-object ("Microsoft.SqlServer.Management.Smo.Server") $instance
$bkdir = "C:\_DBbackups" #We define the folder path as a variable
$dbs = $s.Databases
foreach ($db in $dbs)
if($db.Name -ne "tempdb") #We don't want to backup the tempdb database
$dbname = $db.Name
$dt = get-date -format yyyyMMddHHmm #We use this to create a file name based on the timestamp
$dbBackup = new-object ("Microsoft.SqlServer.Management.Smo.Backup")
$dbBackup.Action = "Database"
$dbBackup.Database = $dbname
$dbBackup.Devices.AddDevice($bkdir + "\" + $dbname + "_db_" + $dt + ".bak", "File")
$dbBackup.SqlBackup($s) -
creating form - want to adjust font style and size in more than one field at a time - HOW??
Select the fields with the mouse, right-click one of them, go to Properties
and set the settings you'd like them all to have.
On Wed, Jan 21, 2015 at 8:51 PM, chuckm38840797 <[email protected]> -
is it possible to install Lightroom 4.1 on more than one computer using the same product code?
Yes, your license key is cross platform PC & or Mac you are allowed to have two current installations with one in use at any point in time. You can uninstall / install as many times as is necessary so long as you adhere to the limits.
-
How to group by more than one fields in crystal reports
Hi
How to create groups in crystal reports by more than one fields, like
select fields,aggregate functions from table group by a,b,cNot sure if I understand your question, but you you could create a formula to generate the string of data you want to group on. Then simply create a group based on the formula field.
For example, your formula could do something like (assuming all String fields):
{table1.FirstName} + {table1.LastName} + {table1.DateOfBirth}
, and then group on this formula.
-MJ
Maybe you are looking for
-
Problem with Iplanet/JWS 6.1 connecting to Weblogic on Solaris
We have an application which runs JSPs and Servlets on SJSWS/Iplanet 6.1 and uses EJBs on Weblogic 8.1 for database access. When the Weblogic server is running on a Windows box, there is no problem accessing the EJBs. But we have not been able to get
-
Itunes playlists no show; 1st external hard drive second mac
very well gentlemen and ladies my cri de coeur concerns accessing my playlists on my new 2nd (and second-hand) mac. All my music is on a hd that mounts on mac2 and plays when click on hd song - BUT old playlists dont show on new mac itunes screen and
-
TS3587 EndNote plug-in still doesn't work
I successfully downloaded the plug-in but the bibliography option still doesn't show up on my Pages. What do I have to do to make it work?
-
Hi, We have a customer with three fixed date of payment depending on the invoice date, but we do not know how to customize payment terms with fixed date. It seems it is not possible with OBB8... Thank you very much, Ariana
-
Error in tdms scrambling activity
Hi, I am running a scenario for tdms HCM. I got this below error while running Define Scrambling Rules (optional) activity. Syntax error in customer code rule Message no. CNV_TDMS_HCM110 Central/Control system here is Solution Manager. I have selecte