Wednesday, October 05, 2016

get all resources of an assembly

Assembly a = Assembly.GetExecutingAssembly();

string[] allManifestResourceNamess = a.GetManifestResourceNames();



foreach (string resourceName in allManifestResourceNamess)


{
Trace.WriteLine(resourceName);

if (resourceName.EndsWith(".sql")) //SQL script Files


{
using (TextReader tr = new StreamReader(a.GetManifestResourceStream(resourceName)))


{
string s = tr.ReadToEnd();


}
}
else if (resourceName.EndsWith(".resources")) //real resources with key Value pairs


{
using (ResourceReader reader = new ResourceReader(a.GetManifestResourceStream(resourceName)))


{
IDictionaryEnumerator dict = reader.GetEnumerator();
while (dict.MoveNext())


{
string key = dict.Key as string;
object val = dict.Value;

}
}
string manifest = resourceName.Replace(".resources", string.Empty);
ResourceManager rm = new ResourceManager(manifest, a);



ResourceSet resourceSet = rm.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
foreach (DictionaryEntry entry in resourceSet)


{
string resourceKey = entry.Key.ToString();
object resource = entry.Value;


}
}
}

webserver iis install webdeploy


IIS Server

start net start wmsvc

download installer:
https://technet.microsoft.com/en-us/library/dd569059(v=ws.10).aspx

then search webDeploy 3.6 (right upper Corner search field)



net start wmsvc & net start msdepsvc
the Web Managment Service must be started, Port 8172 opened
check with telnet

check with browser:
https://52.174.50.95:8172/msDeploy.axd




To diagnose installation problems, Web Deploy MSI logs are placed under %programfiles%\IIS\Microsoft Web Deploy v3

https://www.iis.net/learn/publish/troubleshooting-web-deploy/troubleshooting-common-problems-with-web-deploy

add USer to IIS Managers !!! and on site level to iis Permissions

if username is wrong or ha sno rights, it could be that error 404 (not found) instead of 401 (no rights) is returned


Visual Studio 2015

Server: Ip Adress or name of server, no http etc
SiteName: Default Web Site/test
Username: localhost\admin
pwd...
DestUrl: http://serverNameOrIp/test

test app has to exist on the server

Tuesday, October 04, 2016

IIS Webserver Anwendungs/Application Pool Timeout

wenn die Website beim ersten Aufruf lange braucht um geladen zu werden, so kann man die AppPool/erweiterte Eigenschaften / Leerlauftimeout erhöhen, z.b 1440 Minuten = 24h (60*24),
schienbar sind 1700min (28,3h) max

if webapp Needs Long to start,, you can increase appPool/ext.properties/idleTimeout eg. 1440 minutes = 24 hours. it seems that 1700 (=28,3h) is maximum

Thursday, September 29, 2016

how to install windows 10 mobile aniversary update version 1607

You can find your Version Number in:
Settings/System/info

1507 orig. Windows 10
1511 November Update
1607 Aniversary Update

1) download Windows 10 upgrade advisor (Aktualisierungsratgeber für Windows 10)

Wednesday, September 28, 2016

c# .net Action / Func

Action ist ein delegate für eine Methode ohne Rückgabewert. Hier mit Expliziter (statt anaonymer) Methode:

Action<IBeforeChangeEntry<EntityBase>> updateAction = new Action<IBeforeChangeEntry<EntityBase>>(Trigger_Updating);
Triggers<EntityBase>.Updating += updateAction;

        private static void Trigger_Updating(IBeforeChangeEntry<EntityBase> obj)
        {
            obj.Entity.LastChanged = DateTime.Now;
            obj.Entity.Version += 1;
        }


Anonym:
            Triggers<EntityBase>.Updating += x =>
            {
                x.Entity.LastChanged = DateTime.Now;
                x.Entity.Version += 1;
            };

Tuesday, September 27, 2016

Visual Studio 2015 ASP.NET App Authentication

In VS2015 create new webform project, then a requester ask kind of Authentication and Application Type

Add a Foder LoggedInContent
add there a Web Config like:
<?xml version="1.0"?>
<configuration>
    <system.web>
        <authorization>
            <deny users="?"/>
        </authorization>
    </system.web>
</configuration>

to protect all files in this folder - only authenticated users can access them
add Master Page Forms too the folder
add links from Default Page (available for everyone) to above added MasterPageSitesin LogedInContent

Wednesday, September 21, 2016

ef framework code first migrations with 2 DbContexts

enable-migrations -ContextTypeName EFTest.Model2 -MigrationsDirectory: Mig2
Add-migration -configuration EFTest.Mig2.Configuration Mig20001
update-database -configuration EFTest.Mig2.Configuration –Verbose

http://www.codeproject.com/Tips/801628/Code-First-Migration-in-Multiple-DbContext

only one context:
enable-migrations
Add-migration Mig0001
Update-Database

scripting triggers of sql server datatbase

right click on db, Tasks, generate scripts, next, advanced, table/view Options: Script Triggers = true

Monday, September 05, 2016

EF Update in Context existing Entities

there is a entity e1 in dbContext1, already loaded from database and its sent by server over WCF, changed byclient, sent back over WCF to server, its' not the same entity e1, its another object e2.
If you say Save to Context nothing is saved.
dbContext1 is the Ef Cache and should always contain the newest state of all objects


1) create a new context, attach the e2 and save it to database, update the dbContext 1 from database
2) update e1 with values (and references9 from e2, save to database with DbContext1
3) Detach e1 (set State to Detached)  and Attach e2, set e2. EnitytState to modified

Monday, August 29, 2016

visual studio 2015 performance analyse

Debug / Start Deiagnostic Tools Without Debugging
Choose CPU Usage

Look at Call with biggest Total CPU % and  TotalCPU (ms)

Thursday, August 25, 2016

Friday, August 19, 2016

log4view example / beispiels pattern

^%date{yyyy-MM-dd HH:mm:ss.ffff} |%level |%logger |%m |%exception |

Tuesday, July 05, 2016

sql server filestream

1.) Filestream TSQL

check filestream status:
SELECT * FROM sys.configurations WHERE name = 'filestream access level'

A) Pepare SQL Server

1) configuration Manager / SQL-Server Db Service Propteries / Filestream Tab: Check all
2) EXEC sp_configure filestream_access_level,RECONFIGURE
3) restart SQL Server Service

B) Prepare DATABASE

use testFileStream;


alter database testFileStream ADD FILEGROUP fsg CONTAINS FILESTREAM;


ALTER DATABASE testFileStream ADD FILE ( NAME = N'fsf', FILENAME = N'D:\sqlData\filesteamtest\' ) TO FILEGROUP fsg;


C) Prepare TABLE

its necesarry to have a rowguidcol:

CREATE TABLE dbo.BLOB2 
(
  ID UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL default newid() UNIQUE ,
  BLOB VARBINARY(MAX) FILESTREAM NULL
)
otherwise you get: A table that has FILESTREAM columns must have a nonnull unique column with the ROWGUIDCOL property




alter table blobs add RowID UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL default newid() UNIQUE 
alter table blobs add  [Bytes2] varbinary(max) filestream null;

alter existing Columns doesn't work:

alter table blobs alter column ID UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL default newid() UNIQUE 
alter table blobs alter column [Bytes] varbinary(max) filestream null;


D) Insert Files

 
INSERT INTO dbo.blob2 (blob)


SELECT * FROM
OPENROWSET(BULK N'd:\9bat\test.sql', SINGLE_BLOB) AS Import


or
INSERT INTO [dbo].[FileTableTb] ([name],[file_stream])SELECT'NewFile.txt', * FROM OPENROWSET(BULK N'd:\NewFile.txt'SINGLE_BLOBAS FileData
or

INSERT INTO [dbo].FileTableTb ([name],[file_stream]) SELECT 'test1.txt', CONVERT(VARBINARY(MAX),'TestFileText') AS FileData

or Update Files:
update [dbo].FileTableTb set [file_stream] =(SELECT * FROM OPENROWSET(BULK N'd:\temp\test2.txt', SINGLE_BLOB) AS FileData) WHERE id=12

E) Check Result



select *, blob.PathName() from blob2;

in D:\sqlData\filesteamtest\
there are dirs named with guids (2-levels)


Monday, July 04, 2016

allowing a url

netsh http add urlacl url= http://+:51915/Server.wcfService/ user=domian\username

Sunday, June 26, 2016

win 10 november update langsam / slow

build 10240 läuft auf meinem lenovo thinkstation mit core i5 recht flott, build 10586 extrem langsam - besonders visual studio

Tuesday, June 21, 2016

windows build nummer

HKCU\Control Panel\Desktop den DWORD-Wert (32-Bit) mit dem Namen PaintDesktopVersion hinzufügen und auf 1


https://windowsblog.at/2015/07/31/howto-build-nummer-wieder-am-desktop-anzeigen/

Saturday, June 11, 2016

raspberry pi 3 windows 10 iot

windows iot download mit windows iot dashboard installieren (rasperry pi3: insider preview, custom)

ipadresse:8080 webinerface

powershell admin:
start-service winrm
set-item wsman:\localhost\client\trustedhosts -value * -force
enter-pssession -ComputerName 169.254.63.249 -Credential "169.254.63.249\Administrator"

https://www.hackster.io/
Remote "Desktop":
Windows Iot Remote Clint Universal App Insallieren, im Webinterface am Raspi links unten Remote aktivieren



Monday, May 30, 2016

citadel



list usb devices:
sudo lsusb

list devices
sudo blkid

list partitions:
sudo fdsik -l

list disks by ...:
ls -al /dev/disk/by-uuid/
ls /dev/disk/by-label/

ls /dev/sd*




apt-get install:
ntfs-3g
exfat
hdparm


list power mode of hd:
sudo hdparm -C /dev/sda

dmesg

raspberry pi fernzugriff mittels VNC

vnc server:

sudo apt-get update
sudo apt-get install x11vnc
x11vnc -usepw -forever -rfbport 12345 -display :0

startet server mit port 12345

Saturday, May 14, 2016

W10: UWP Packages auf Windows 10 Handy (Mobile) laden deployen

Visual Studio:
rechte Maustaste auf App, Store, Create Package (No Store)


Handy:
Wlan ein
Einstellungen / Update und Sicherheit / Für Entwickler / Entwicklermodus,
Gerätesuche ein
Geräteportal ein
unter Geräteportal steht Verbindung herstellen über:
WiFi
https://x.y.z.a (IpAdresse)

mit Browser auf Handy Ip (steht unter Geräteportal siehe oben) verbinden und koppeln - wichtig: Handy und PC müssen im selben Subnetz sein

in App Manager App Uploaden: ....AppxBundle

Friday, May 13, 2016

rasperry pi

LED am GPIO Pin 12 ein und ausschalten:

import Rpi.GPIO as IO
import time
OI.setmode(IO.BOARD)
IO.setp(12,IO.OUT)
state=True
while True:
  IO.output(12,state)
  state= not state
  time.sleep(1)


falls GPIO nicht vorhanden, mit apt-get installieren


Temperatursensor 
Dallas-18820 
1607C4+23AA

Wednesday, May 04, 2016

oracle can connect with sqlplus but not with sql developper / kann mit sqlplus verbinden aber nicht mit sqldeveloper

sqlplus braucht für Verbindungen zum lokalen host unter Angabe der Sid scheinbar keinen listener:
sqlplus user/pwd@sid

für tns jedoch schon:

splplus user/pwd@tnsName

SQL developper braucht auch einen listener zum verbidnen, wenn also sqlplus funktioniert, dann ist wahrscheinlihc der listener falsch konfiguriert (Hostanem ...)

Thursday, April 28, 2016

oracle tablespace verkleinern / resize smaller


get minimum size of files / minimalgroesse der Datei:
select f.file_name, (t.block_size*max(e.block_id)/1024/1024) MB
from dba_tablespaces t, dba_data_files f, dba_extents e
where e.tablespace_name = 'SYSAUX'
and   e.tablespace_name = f.tablespace_name
and e.tablespace_name = t.tablespace_name
group by f.file_name, t.block_size;


alter database datafile '' resize  ;

durch reorganisieren des frgamentierten Files kann die minimalgroesse herabgesetzt werden - the minimal size can be reduced by reorganicing the fragmented tablespace:

  1. get objects at end of file (first rows):
    set pagesize 3000
    set linesize 3000
    select e.file_id, max(e.block_id),
    e.owner, e.segment_name, segment_type, partition_name
    from dba_extents e
    where e.tablespace_name = 'SYSAUX'
    group by e.file_id, e.owner, e.segment_name, segment_type, partition_name
    order by 1 desc , 2 desc;
  2. reorganize object blocking end of file:
    alter table owner.tablename move;
    alter Index rebuild;
     
  3. get minimum size of file shrink:
    select f.file_name, (t.block_size*max(e.block_id)/1024/1024) MB
    from dba_tablespaces t, dba_data_files f, dba_extents e
    where e.tablespace_name = 'SYSAUX'
    and e.tablespace_name = f.tablespace_name
    and e.tablespace_name = t.tablespace_name
    group by f.file_name, t.block_size;
  4. shrink file:
    alter database datafile 'C:\ORA_DAT\myfile.DBF' resize 4500M;

Thursday, April 14, 2016

Entity Framework AddOrUpdate

funktioniert gut, solange das Objekt nicht im lokjalen Speicher vorhanden ist - dann macht die Methode nämlich gar nichts

https://blog.oneunicorn.com/2012/05/03/the-key-to-addorupdate/

Außerdem ist es möglich, dass die DbSet Listen Einträge mit doppeltem Key enthalten - der wird dann erst beim Schreiben in die Datenbank geprüft und man erhält dann eine Key Violation. Daher besser zunächst zu suchen und dann zu adden.

Saturday, April 02, 2016

ssl zertifikat erstellen und iis https (ssl) einrichten

1) SLL Zertifikat erwerben und installieren am IIS:

1a) Zertifikats Anforderung erstellen:

Im IIS unter server \ serverzertifikate mit rechter Maustasete eine Zertifikatsanforderung erstellen und speichern => man erhält ein Textfile das in etwa so aussieht:
oder auf bestehendes Zertifikat renew klicken

-----BEGIN NEW CERTIFICATE REQUEST-----
blablabla
-----END NEW CERTIFICATE REQUEST-----

1b) Zertifikat von Zertifizierungsstelle austellen lassen:

diesen Text dann in die Zwischen ablage kopieren und beim Zertifikatsanbieter einfügen.
kostenlose Webzertifikate gibt z.b. startssl.com - allerdings seit ende 2016 werden diese von vielen Browsern nicht mehr als sicher erachtet.

1) email adresse angeben => erhalte code, mit diesem wird dann ein zertifiakt ausgestellet, das man in den Webbrowser importieren muß (neu starten des Webbrowsers) dann wieder startssl.com ansurfen, einloggen
2) hostname validieren
3) zertifikat erstellen mittels wizard => zip file enthält iis.zip, dieses enthält ein CRT File

sslmarket.at
1) konto erstellen
2) zertifikat beantragen => brauche Emailadresse für die ssl domain


1c) Zertifikat importieren in IIS:

Intermediate Zert sollte vorher in die Zwischenzertifizierungsstellen importiert werden (Zert Manager)

das File von der Zertifizierungsstelle dann im IIS unter server\serverzertifikate mit rechter Maustaset Zertifikatsanforderung abschließen importieren (*.* bei txt auswählen)
bei Problemen zunächst als Perönliches Certt abschließen, exportieren (pfx), löschen und neu importieren als Webhosting

2) Webinhalt für https freigeben

2a) Website ssl Bindung hinzufügen

Website auswählen, bei Bindungen https hinzufügen und zuvor importiertes Zertifikat auswählen, es sollten dann z.b.  eine Bindung für Port 80 und eine für 443 existieren,

2b) Firewall Port 443 freigeben

2c) Web Servicekonfigurieren

http://blog.adnanmasood.com/2008/07/16/https-with-basichttpbinding-note-to-self/

The modified basicHttpBindinging to allow security mode = Transport
<bindings>
            <basicHttpBinding>
                <binding name="defaultBasicHttpBinding">
                    <security mode="Transport">                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <services>
            <service behaviorConfiguration="MyServiceBehavior"
            name="MyServiceName">   
                <endpoint address="https://AdnanMasood.com/MyService.svc"
                            binding="basicHttpBinding"
                            bindingConfiguration="defaultBasicHttpBinding"
                            contract="Axis.IServiceContract" />
            <serviceBehaviors>           
                <behavior name="MyServiceBehavior">
                    <serviceMetadata httpsGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <add key="CustomIISServiceHostEndPoint" value=https://AdnanMasood.com/MyService.svc"/>
    </appSettings>

which corresponds to your end point.
<system.serviceModel>        
and the httpsGetEnabled
<behaviors>
and last but not least, if hosting in IIS, here is the key for custom factory. Details about how to do this part can be found on the MSDN article "Deploying an Internet Information Services-Hosted WCF Service" referenced below.
    <appSettings>        




Tuesday, March 29, 2016

The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects.

When using more then one Context, Objects have to be detached before added to another one

Saturday, March 26, 2016

Adding Wcf Service Logging

you don't need to change your source code just add to your service web.config:

<system.diagnostics>
<sources>
<source name="System.ServiceModel"
                    switchValue="Information, ActivityTracing"
                    propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "C:\Log\wcf.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>

Friday, March 25, 2016

visual studio or iis: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.

HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.


solution: add  <directoryBrowse enabled="true" /> for root path:



  <location path=".">
    <system.webServer>
      <directoryBrowse enabled="true" />
    </system.webServer>
  </location>

Tuesday, March 22, 2016

Disk / Drive / Partition Image software

Norton Ghost:
takes long to install, installer often opens command prompt and interrupts you, complicated gui, can' t read Linux partitions

DriveImageXML: can`t read Linux partitions

Acronis2016: can read Linux partitions, very comfortable gui, but I tried to use test version to make backup didn't work

Partition Image: is a dos tool, doesn't work under windows 10 (first attemp, no time for second try)

compare andronoid - windows 10 phone

I had a Samsung S3 neo and switched to Lumia 640.

summary: windows phone 10 has fewer apps than andronoid, but those apps are more stable and faster than andronoid

Writing is faster and reliabler on Windows 10 phone than on the andronoid system.

Navigation: on Lumia there is the here navigation installed, which has offline maps and speed warning, but I didn't find the traffic jam visualisation like google maps.

Energy: the Lumia Akku endures longer then the Samsung, I think windows phone 10 is more power saving

Thursday, March 10, 2016

Continous Integration Build with visualstudio online: No queue was specified in the build request.

if you get error        
No queue was specified in the build request.
set
General Tab -> Default agent queue = Hosted


to set up new CI build:
Go to Build Menu of your project
create new Build definition by pressing +
General Tab -> Default agent queue = Hosted

Wednesday, February 10, 2016

Update Wpf StatusLabel from other thread - Status Label auf richtigem Thread updaten

        ///


updates StatusLabel on Gui Thread
        /// StatusText to set
        private void UpdateStatus(string sStatus)
        {
            Trace.WriteLine(sStatus);
            if (!LblStatus.CheckAccess()) //Check if correct Thread
            {
                LblStatus.Dispatcher.BeginInvoke(DispatcherPriority.Send, //Wrong Thread
                    new Action(UpdateStatus), sStatus); //start again on correct thread
                return; //and leave
            }
            LblStatus.Content = sStatus; //only on correct thread the label is set
        }



call like this:
1) start longrunning Task:

Task.Factory.StartNew(MyLong,TaskCreationOptions.LongRunning);


2) call Update Status from Longrunning Task
        private void MyLong()       
{
            UpdateStatus("do some Long time ...");       

}

Tuesday, February 09, 2016

get Backup sets of a Backup file including more than one backup

declare @backupFile varchar(max) = 'C:\SqlBackup\test.BAK';
-- THIS IS SPECIFIC TO SQL SERVER 2012 and 2014
--
declare @headers table
(
    BackupName varchar(256),
    BackupDescription varchar(256),
    BackupType varchar(256),       
    ExpirationDate varchar(256),
    Compressed varchar(256),
    Position varchar(256),
    DeviceType varchar(256),       
    UserName varchar(256),
    ServerName varchar(256),
    DatabaseName varchar(256),
    DatabaseVersion varchar(256),       
    DatabaseCreationDate varchar(256),
    BackupSize varchar(256),
    FirstLSN varchar(256),
    LastLSN varchar(256),       
    CheckpointLSN varchar(256),
    DatabaseBackupLSN varchar(256),
    BackupStartDate varchar(256),
    BackupFinishDate varchar(256),       
    SortOrder varchar(256),
    CodePage varchar(256),
    UnicodeLocaleId varchar(256),
    UnicodeComparisonStyle varchar(256),       
    CompatibilityLevel varchar(256),
    SoftwareVendorId varchar(256),
    SoftwareVersionMajor varchar(256),       
    SoftwareVersionMinor varchar(256),
    SoftwareVersionBuild varchar(256),
    MachineName varchar(256),
    Flags varchar(256),       
    BindingID varchar(256),
    RecoveryForkID varchar(256),
    Collation varchar(256),
    FamilyGUID varchar(256),       
    HasBulkLoggedData varchar(256),
    IsSnapshot varchar(256),
    IsReadOnly varchar(256),
    IsSingleUser varchar(256),       
    HasBackupChecksums varchar(256),
    IsDamaged varchar(256),
    BeginsLogChain varchar(256),
    HasIncompleteMetaData varchar(256),       
    IsForceOffline varchar(256),
    IsCopyOnly varchar(256),
    FirstRecoveryForkID varchar(256),
    ForkPointLSN varchar(256),       
    RecoveryModel varchar(256),
    DifferentialBaseLSN varchar(256),
    DifferentialBaseGUID varchar(256),       
    BackupTypeDescription varchar(256),
    BackupSetGUID varchar(256),
    CompressedBackupSize varchar(256),       
    Containment varchar(256),
    --
    -- This field added to retain order by
    --
    Seq int NOT NULL identity(1,1)
);
insert into @headers exec('restore headeronly from disk = '''+ @backupFile +'''');
select * from @headers

Sunday, February 07, 2016

Vergleich Andronoid / Windows Phone 8.1

Live Tiles sind Platzsparender als Widgets, insgesamt kriegt man eine höhere App Dichte auf den Bildschirm, allerdings sind die Andronoid Icons hübscher

Tuesday, February 02, 2016

simple power shell sql server invoke sqlcmd test

for example a SQL express Server, using sa to connect:

invoke-sqlcmd  -Query "select * from sys.database_files;" -serverinstance localhost\SQLEXPRESS  -Username sa -Password yourPwd

initialiszing model Database of sql server to minimize fragmentation of new databases / ändern der model Datenbank des SQL Servers um fragmentierung niedriger als mit den default werten zu halten

--init Sql Server
use model;
IF (8192>(select size from sys.database_files where file_id=1)) ALTER DATABASE model MODIFY FILE (NAME = [modeldev], SIZE=64MB);
ALTER DATABASE model MODIFY FILE (NAME = [modeldev], FILEGROWTH = 10%, MAXSIZE = UNLIMITED);
IF (8192>(select size from sys.database_files where file_id=2)) ALTER DATABASE model MODIFY FILE (NAME = [modellog], SIZE=64MB);
ALTER DATABASE model MODIFY FILE (NAME = [modellog], FILEGROWTH = 64MB, MAXSIZE = UNLIMITED);

Monday, February 01, 2016

passing variables from power shell to sql server by using Invoke

power Shell script:
==============

param(
    [Parameter(Mandatory=$true)]
    [string]$PWD,
    [string]$saUser="sa",
    [string]$ServerInstance="localhost\SQLEXPRESS"
)
$winUser=([Environment]::UserDomainName)+"\"+([Environment]::UserName)
Write-Host "Windos User=" $winUser
$sqlVars = "V1 = 'testV1'", "V2 ='$winUser'"
Invoke-Sqlcmd -Query "SELECT `$(V1) AS V1, `$(V2) AS V2;" -Variable $sqlVars -serverinstance $ServerInstance  -Username $saUser -Password $PWD
invoke-sqlcmd   -InputFile "test.sql " -Variable $sqlVars -serverinstance $ServerInstance  -Username $saUser -Password $PWD


SQL Script (test.sql):
================
select $(V1) as v1, $(V2) AS V2;

Wednesday, January 20, 2016

rename sql server hostname / sql server umbenennen

select * from sys.servers
exec sp_dropserver 'oldname\SQLEXPRESS'
exec sp_addserver 'newname\SQLEXPRESS',local

local is important, beacause without depricated
local ist wichtig ansonst en ist add_server depricated

Monday, January 11, 2016

oracle free sysaux tablespace



select dbms_stats.get_stats_history_retention from dual;
exec dbms_stats.alter_stats_history_retention(10);
--delete old statistics
exec DBMS_STATS.PURGE_STATS(sysdate -10);

further info:

Friday, January 08, 2016

SSRS Reportitems to access Textbox Values

SSRS Sql Server Reporting Services:

How to access Values of Textboxes in expressios...
Werte aus Textboxen in Expressions referenzieren

Reportitems!B5_CA204.Value

Thursday, January 07, 2016

Sql Server Reporting Services SSRS: LOOKUP Simple Example - einfaches Beispiel

simple Example:
Lookup("searchstring",KeyColumn,ValueColumn,"Datasetname"):

=Lookup("Key1",Fields!DataKey.Value,Fields!DataValue.Value,"AllDataItems")


searchsring can also be expression, but


other expressions:
=IIF(Count(Fields!MA.Value)>1,"Red","No Color")