顯示具有 sql 2008 標籤的文章。 顯示所有文章
顯示具有 sql 2008 標籤的文章。 顯示所有文章

2018年5月16日 星期三

Listing information about all database files in SQL Server in MB size

https://stackoverflow.com/questions/43472717/get-actual-database-size-in-sql-server-2012-in-gb
https://stackoverflow.com/questions/27057000/sql-server-get-all-databases-with-mdf-and-ldf-file-location

SELECT
    db.name AS DBName,
    type_desc AS FileType, size * 8/1024 AS MBSize,
    Physical_Name AS Location
FROM
    sys.master_files mf
INNER JOIN 
    sys.databases db ON db.database_id = mf.database_id

Table Size
https://stackoverflow.com/questions/7892334/get-size-of-all-tables-in-database


Here is another method: using SQL Server Management Studio, in Object Explorer, go to your database and select Tables




Then open the Object Explorer Details (either by pressing F7 or going to View->Object Explorer Details). In the object explorer details page, right click on the column header and enable the columns that you would like to see in the page. You can sort the data by any column too.

2018年1月18日 星期四

sp_addlinkedserver SQL 2008

Test Server for PWHOT1 VM clone and change computer name and SQL Server name. but DBLink Connect still old.


select name from sys.servers
select * from sys.servers


sp_dropserver 'PWHOTRPT'
GO

-Add DB Link Server
EXEC sp_addlinkedserver
@server = 'PWHOTRPDRATEST', --Server Name
@srvproduct = 'MS SQL',    <------  on other web said 'SQL Server' , but cannot execute
@datasrc = 'PWHOTRPDRATEST' , --Server IP or Hostname
@provider = 'SQLNCLI'

select name from sys.servers
select * from sys.servers


https://dotblogs.com.tw/puma/2009/02/05/7038
http://tsuozoe.pixnet.net/blog/post/22417837-sp_addlinkedserver-%E3%80%81-sp_dropserver-%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95-
https://stackoverflow.com/questions/35799905/could-not-find-server-server-name-in-sys-servers-sql-server-2014

2017年7月19日 星期三

mirth pwhot using pre-caution

http://unicolet.blogspot.hk/2012/08/mirth-recover-space-when-mirthdb-grows.html

appdata\mirthdb\seg0

C:\Program Files\Mirth Connect\appdata\mirthdb\seg0

https://www.experts-exchange.com/questions/28694112/Derby-Database-Seg0-folder-dat-files-growing-too-large.html

Author Commentby:robthomas09
ID: 409026422015-07-28
I ended up uninstalling Mirth after exporting my channels and reinstalling mirth and all of the space freed up.


mirth 191.1.1.183 make no space for PWHOT1


As noted on our wiki, the embedded Derby database is not recommended for production use. It's meant for quick deployment, development, and testing. For production use, you should switch to one of the other supported databases (PostgreSQL, MySQL, Oracle, or SQL Server).
__________________

http://www.mirthcorp.com/community/wiki/display/mirth/System+Requirements

ePR unsubscribe

Aim to create message auto from sequential database then send

Caution , UNDEPLOY the channel after run. else 1) restart mirth will redepoly 2) keep creating file in high speed in your local harddrive. 3) eat up all your harddisk space 4) hang the mirth and no way to delete


  ALTER TABLE [PWHOT].[dbo].[sheet1]
   ALTER COLUMN patient_key nvarchar(50)

ALTER TABLE dbo.YourTable
   ALTER COLUMN YourColumnName BIT
 

How to change column datatype in SQL database without losing data


Hints: on DB Quere you can remove "[]"

How to use the Mirth Transformer

Hints :https://www.youtube.com/watch?v=nTAmnfLMO0A

SELECT a.userID, b.usersFirstName, b.usersLastName  FROM databaseA.dbo.TableA a inner join database B.dbo.TableB b  ON a.userID=b.userID

PHHOT.dbo.sheet1 = [PHHOT].[dbo].[sheet1]

Hints: java.lang.Thread.sleep(5000) on Mirth -> Destinations -> Step

How to create a table from select query result in SQL Server 2008 [duplicate]

Hints : SELECT * INTO NewTable FROM OldTable

Convert XML to HL7 messages using Mirth Connect

Hints : http://irwinj.blogspot.hk/2008/12/getting-started-with-mirth-part-1.html

HINTS: Trace: • Mirth Connect Introduction and Tutorial
http://wiki.patesco.ca/doku.php?id=hl7:mirth:tutorial

HINTS : https://amarnathks.wordpress.com/tag/mirth-beginner-tutorial/

Enable Run On Update Statement if you wish to update something after reading data from table. Here i have updated the status flag to 1 such that those details will not be read again. You can now see the selected data values in the right side of On Update SQL.


question : Is it possible to configure the File Writer to create a file name based on the PID.2 segment (chart ID) so each patient account would have it's own file for ADT messages?

HINTS: http://www.mirthproject.org/community/forums/showthread.php?t=11120
Yes, definitely. Extract the PID.2 out into a map variable, and then in the destination settings just drag your map variable into the Filename field

Transformer -> New Step -> Mapper -> change this step to "Channel Global Map"" -> set variable as filenamePatKey , and Mapping as msg['pmhgoodresult_patient_key'].toString()
then
Destination -> file writer -> on right side " Destination Mapping " you can find filenamePatKey you just create

question : mirth database reader endless loop

HINTS : isdone flag on DB for notice

2017年6月21日 星期三

sql to reduce/shrink LDF file size in SQL Server

To reduce the .ldf file, you must do three things:

  • Backup the database
  • Stop the database service
  • Shrink the .ldf file




SELECT name, physical_name AS current_file_location
FROM sys.master_files

Following is the output of files used by my SQL Server instance.

-------

Bill_Ryan
Jalapeno
Best Answer
Bill_Ryan  
In  Server Management Studio Right click on the database in question and go to Properties:
  • Go to "Options" on the left
  • Change the line "Recovery Model:" from Full to "Simple" and hit OK
  • Right click on the database again, go to Tasks - Shrink - Files
  • Under File Type: select Log and click OK
This will temporarily free up space for you, make sure that your database is set to back up and that its configured to empty the log after back up. Once you have resolved the space issue and made sure your log file is set to flush after backups, I recommend you put the recovery model back on Full. If it was already set to flush the log after backup, check to see why the backups aren't being done...
GerardMainardi
Datil
GerardMainardi  
Do you NEED that log?  If so, you've certainly got a problem.
Otherwise, you can go the ghetto solution that will take care of it in the short-term: change the database recovery model to simple, then change it back and set a new log size. (Right click database, properties, options, recovery model).
Let me know if you need more detailed instructions than this.  You'll lose all that transaction log, but this will do it.
EDIT: Bill beat me to it