search

Latest posts


To create a login (server wide account) which uses a simple username + password combination for SQL authentication:

CREATE LOGIN ReadOnlyUserName WITH PASSWORD = 'strong_password';

NOTE: This allows the user to connect using SQL Management Studio. It is not required if the user only needs to connect to a specific database.

 

To create a user to be used only with a particular application/database:

CREATE USER ReadOnlyUserName WITH PASSWORD = 'strong_password';

NOTE: The user can only connect to the specific database. They cannot connect using SQL Management Studio (unless they have a login too).

Give the new user “select” permissions to a specific table:

GRANT SELECT ON dbo.Books to ReadOnlyUserName;

Give the new user “read-only” permissions to a database:

ALTER ROLE db_datareader ADD MEMBER ReadOnlyUserName;

To give the new user “write” permissions to a database:

ALTER ROLE db_datawriter ADD MEMBER ReadOnlyUserName;

To remove a user or login:

DROP Login ReadOnlyUserName;

DROP USER ReadOnlyUserName;

 

List roles & role members:

WITH RoleMembers (member_principal_id, role_principal_id)
AS
(
SELECT
rm1.member_principal_id,
rm1.role_principal_id
FROM sys.database_role_members rm1 (NOLOCK)
UNION ALL
SELECT
d.member_principal_id,
rm.role_principal_id
FROM sys.database_role_members rm (NOLOCK)
INNER JOIN RoleMembers AS d
ON rm.member_principal_id = d.role_principal_id
)
select distinct rp.name as database_role, mp.name as database_userl
from RoleMembers drm
join sys.database_principals rp on (drm.role_principal_id = rp.principal_id)
join sys.database_principals mp on (drm.member_principal_id = mp.principal_id)
order by rp.name

 


To determine the MSSQL version:

SELECT @@version

On Error Resume Next 'turn off error handling
Application.DisplayAlerts = False 'turn off alerts

Worksheets("Summary").delete
Worksheets("RBI").delete
Worksheets("HR").delete
Worksheets("ERA").delete

Application.DisplayAlerts = True 'turn alerts back on
On Error GoTo 0 'turn error handling back on

Each photo is 4 seconds – 3 seconds for the photo and 1 second for the transition (cross dissolve).

I use the photo album theme with a senior pic as the album cover along with their name.

Each video is roughly divided into 4 sections (pre-elementary, elementary, middle, and high school). The first three sections correspond to songs 1, 2, and 3. The high school section usually requires two songs because usually there are more pictures in this section. The transition for each section is a photo albums theme transition. Each photo within the section is a simple cross dissolve.

At the end of the video I add a page turn transition back to the first baby picture, page turn to a senior picture, page turn to a family, and finally page turn to a silly picture.

Photos & Video Times:
100 photos = ~ 6:39
150 photos = ~ 9:56
200 photos = ~ 13:16
250 photos = ~ 16:36
288 photos = ~ 19:11

 


Using Microsoft Azure PowerShell and Azure Service Manager, this script will loop through all provisioned cloud services and display them in a selection box to allow multiple cloud services to be selected to be deprovisioned and deleted, easily, at one time.  Very handy for cleaning up after demonstrations and student labs.


# Modified from a blog post by Keith Mayer # http://blogs.technet.com/b/keithmayer/archive/2014/03/27/step-by-step-cleaning-up-the-cloud-with-microsoft-azure-and-powershell.aspx # Find the name of your subscription # Get-AzureSubscription | Format-Table –Property SubscriptionName #find out your subscription name $subscription = "MIIS Pilot Fall 2015" # Set the storage account $storageacct = "datasecstor" Set-AzureSubscription -SubscriptionName $subscription -CurrentStorageAccount $storageacct # Set the container $container = "vhds" # Generate a list of all provisioned cloud services within our Azure subscription Get-AzureService | # Pull in the name property of each cloud service Select-Object @{"Label"="ServiceName";Expression={$_.Label}} | # Generate a selection listbox to select the cloud services we wish to deprovision and delete Out-GridView -Title "Select VM Deployments to Remove" -PassThru | ForEach-Object { $name = $_.ServiceName $searchname = "*" + $name + "*.status" # Stop the virtual machine Stop-AzureVM -Name $name -ServiceName $_.ServiceName -Force # Remove the virtual machine and delete the VHD Remove-AzureDeployment -ServiceName $_.ServiceName -Slot Production -DeleteVHD -Force # Remove the cloud services entry Remove-AzureService -ServiceName $_.ServiceName -Force # Look for the .status files that match the name of the virtual machine being removed and delete them as well Get-AzureStorageBlob -Container $container -blob $searchname | ForEach-Object {Remove-AzureStorageBlob -Blob $_.Name -Container $container} }

To count the number of rows in a Microsoft SQL database table:


SELECT COUNT(*) FROM dbo.table_name;

 


Download and Install Windows Management Framework:

https://www.microsoft.com/en-us/download/details.aspx?id=48729

Ref: https://msdn.microsoft.com/en-us/library/mt125356.aspx

 

Start –> All Programs –> Accessories –> Windows Powershell

Right-click Windows Powershell ISE and select “Run as Administrator”

Execute the following in the PowerShell window:


Install-Module AzureRM #Install the Azure RM modules Install-AzureRM #Download and install each module of Azure RM Install-Module Azure #Install the ASM module Import-Module AzureRM #Load ARM cmdlets Import-Module Azure #Load ASM cmdlets

 



sudo apt-get update     #Gets list of available updates sudo apt-get -y upgrade    #Upgrades current packages sudo apt-get -y dist-upgrade   #Installs new updates #Run as a single command sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade

In theory, we set a String variable populated with “before” indicating that “results” have not been populated with .executeQuery yet.

Set a watch on the String variable. Set a breakpoint so you can see the variable populate with your “before” text. Set a breakpoint on the first line of the setters code so you can see the variable after .executeQuery is run.

Debug the app, stopping at the break points and then continuing after you view the watch results.

If you see “no_results” in the watch, you know the query is not working correctly and not bringing back the data (results is empty).  If you see “before” in the watch, you know that results has data (the query is working and bringing data back). This may indicate you have a problem with your setters. It could be the setter name, the database field name, or the data type.


String res = "before";  // create a variable and fill with 'before' // indicating it's before results are filled. this.results = ps.executeQuery(); // this.results.next(); if (!this.results.next()) {      // results is empty - it's not filled from the db query res = "no_results"  // fill the res variable with 'no_results' }

When using Oracle SQL Developer to connect to an Oracle database housed on a VM in Microsoft Azure, Developer will “timeout” after approx. 2 – 3 minutes due to Azure closing unused connections. Using this configuration, Oracle SQL Developer will hold the connection open indefinitely.

Download and unzip the Oracle InstantClient:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

Put the unzipped directory in a folder on your local drive.

Within Oracle SQL Developer, select Tools –> Preferences.  In the left pane, choose Database –> Advanced

 

Configure Oracle SQL Developer to prevent timeout when connecting to Azure

Configure Oracle SQL Developer to prevent timeout when connecting to Azure

Restart Oracle SQL Developer

 

On the Oracle server,  edit sqlnet.ora to add the line:

SQLNET.EXPIRE_TIME=1

Restart the server.


‹ previous posts next posts ›
close
search

Hi, guest!

settings

menu