Skip to main content

Posts

Showing posts with the label Microsoft SQL Server

How to create a user in DB MS SQL Studio

Below steps will guide you to create user in Microsoft SQL Management Studio and in Siebel. First create login, open MS SQL Management Studio and connect with database.Run below SQL statement. CREATE LOGIN <user-name> WITH PASSWORD = '<password>'; CREATE LOGIN EAIUSER WITH PASSWORD = 'EAIUSER'; Now create user in database. The SQL create user command takes the following syntax: create user <user-name> for login <login-name> create user EAIUSER for login EAIUSER Now you need to provide permissions to newly created user in database. There are tow ways based on user role in the organization select the appropriate method. One to provide the rights of specific database or assign the Membership role to newly created user. Expand the DB and go to Security/Users and find or add filter for new user as seen below. Right click and open properties. Now go Securables and click on Search button. A new window will popup as seen below. Check the Specific Objects...

Find slow running queries on MS SQL Server

Source Below query will helps you find the queries which have taken a lot of time in milliseconds. To confirm that you have query performance issues on your SQL Server instance start by examining queries by their execution time. SELECT     req.session_id     , req.total_elapsed_time AS duration_ms     , req.cpu_time AS cpu_time_ms     , req.total_elapsed_time - req.cpu_time AS wait_time     , req.logical_reads     , SUBSTRING (REPLACE (REPLACE (SUBSTRING (ST.text, (req.statement_start_offset/2) + 1,        ((CASE statement_end_offset            WHEN -1            THEN DATALENGTH(ST.text)              ELSE req.statement_end_offset          END - req.statement_start_offset)/2) + ...

How to check Communications Outbound Manager jobs status SQL

When using " Communications Outbound Manager " business service Siebel create a job record in " S_SRM_REQUEST " table. You can easily check the status of these jobs by using below query which is written for MS SQL Manager Studio. SELECT STATUS ,CREATED,ROW_ID,DESC_TEXT,ENTERPRISE_NAME,EXEC_SRVR_NAME,PARAM_VAL,RESP_TEXT,COMPLETION_TEXT FROM S_SRM_REQUEST WHERE 1=1 AND DATEPART ( YEAR ,CREATED) = '2022' AND DATEPART ( MONTH ,CREATED) = '04' AND DATEPART ( DAY ,CREATED) = '06' AND ( PARAM_VAL LIKE '%SendMessage%' OR PARAM_VAL LIKE '%CreateRequest%' ) ORDER BY CREATED DESC

How to remove Line Break when selecting data from SQL Server

When you run SELECT query and copy the result to notepad or excel instead of one row columns with new line character shifts to new row. char(13) is carriage return (is a control character or mechanism used to reset a device's position to the beginning of a line of text) and char(10) is line feed (new line). Below query will eliminate carriage return and new lines from a column of a table. The inner replace replaces line feed and the outer replace replace carriage return SELECT Replace ( Replace( X_DIVISION, CHAR (10), '' ), CHAR (13), '' ) FROM S_CASE_X WHERE PAR_ROW_ID = '1-8I4G98D' Source: Stackoverflow 28628342, Wikipedia See Also: How to remove Line Breaks from a string using Siebel eScript

How to create SQL DB Views in MS SQL Server

This Article will cover below points: How to create DB View in Microsoft SQL Server. How to provide permissions to DB View. How to export DB View to .sql file. How to create DB View in Microsoft SQL Server: Connect MS SQL Server to Siebel DB. Expand the Siebel DB and navigate to Views Right click on Views and Select New View.. This might take few minutes on first use and it will open below new window from where you can create db view by selecting Table, Views etc. But I prefer to write query and directly use.Click on Close button. On Close you can see a new query window with three sections.  1st section will show the table/ view relational diagram. 2nd section will show the Columns and their details. 3rd window will have the SQL query. Copy and Paste the SQL query in 3rd section and click on other section, MS SQL Server will auto create the relation diagram and populate the Column details. From the top tool bar click on Save button and MS SQL Server will ask for DB View name, pr...