This pattern works well:
IF OBJECT_ID('ThisSproc', 'P') IS NOT NULL
DROP PROCEDURE ThisSproc;
CREATE PROCEDURE ThisSproc
@NewMoneyCollected MONEY = 0
SET Balance = MoneyCollectedAllYear + @NewMoneyCollected
WHERE PersonId = @PersonID;
IF @@TRANCOUNT > 0
DECLARE @ErrorNumber INT = ERROR_NUMBER();
DECLARE @ErrorLine INT = ERROR_LINE();
DECLARE @ErrorMessage NVARCHAR(4000) = ERROR_MESSAGE();
DECLARE @ErrorSeverity INT = ERROR_SEVERITY();
DECLARE @ErrorState INT = ERROR_STATE();
-- use as debugging tool
-- PRINT 'error number: ' + CAST(@ErrorNumber AS VARCHAR(10));
-- PRINT 'line number: ' + CAST(@ErrorLine AS VARCHAR(10));
RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
The full error message reads as "Failed to deploy project. For more information, query the operation_messages view for the operation identifier '39212'. (Microsoft SQL Server, Error: 27203)
In a nutshell, the most common reason for this is the latency between SQL Server logging the deployment operation within the SSIS catalog database and the stored procs that actually commit the deployment.
Try the deployment again.
If you aren't able to install from the Help\Install New Software menu, it is probably because the zip file doesn't have the content.jar/artifacts.jar needed to do so. You will need to navigate to where you've installed Eclipse, then follow these steps:
1. Navigate to the Dropin drectory
2. Create a new subdirectory (folder).
3. Expand the zip file to the subdirectory folder.
4. Restart Eclipse
5. Under the Windows\Open Perspective menu, look for your plugin.
This usually happens when you restore a database. For example, you restore a copy of production database X to your QA server. In essence, you have overwritten the user info of that specific database with what exists in production. This creates an orphan user -- where you have no login associated with a user in that database on a server that once associated that user with the old copy of the database.
Here is what to do fix the issue:
1. Validate that what you think is the problem is the problem. Do this by listing the known orphans. You may have others show up--but be sure the id you are interested in is on the list:
use [your database instance]
EXEC sp_change_users_login 'Report'
2. Fix the broken login:
EXEC sp_change_users_login 'Auto_Fix', 'orphan username'
There are several reasons for this. The most common reason is that the account you are using while logged into mssql through ssms does not have access to the drive definition you are using as your source. Network drives are a good example of an access conflict.
Assuming you have access to the drive, try redirecting the network drive to a local drive letter via xp_cmdshell (Note: be sure use of xp_cmdshell is enabled) .
exec master..xp_cmdshell 'net use Z: "\\BackupServerXX\<share>\PathWithoutTrailingSlash" YourADpasswordHere /user:domain\your.Username'
Declare @restorefile varchar(1024) = 'Z:\thebackupfile.bak'
Restore database x
From disk = @restoreFile
When you are done, or if you've made a mistake and need to reassign the drive, delete the reference.
exec master..xp_cmdshell 'net use Z: /delete'
In SSMS, there's a Generate Script utility (read: only available under version 2008 and up) .
Here are the steps you would need to take to make use of the utility:
- Right click on the database you're interested in and go to Tasks -> Generate Scripts
- Select the tables and/or any other objects you'd like in order to get them into the script.
- Navigate to Set scripting options. Click on Advanced.
- Under the General category, navigate to Type of data to script
- Select the Schema and Data option to get the insert statements generated. Click OK.
Here's an example using forfiles to scan your storage. This command line will look for files over 200mb on the C:\ drive after 1/1/2014.
forfiles /P C:\ /M *.* /S /D +"01/01/2014" /C "cmd /c if @fsize gtr 209715200 echo @path @fsize @fdate @ftime"
For more information, check out Microsoft's examples and syntax page:http://technet.microsoft.com/en-us/library/cc753551.aspx
Try using count_big(*) instead-- this is defined as bigint instead of int.
In this example, I am looking for how many 100s of millions of rows exist by product type where each row is roughly 300 bytes wide to ultimately obtain how many gigabytes of data I need to provision.
count_big(*) as ProdCount,
(count_big(*)*300) as TotalBytes,
((count_big(*)*300)/1073741824) as Gigabytes
from fdwintegration.etl.fuelpriceindex x
inner join fdwintegration.etl.FuelProducts y
on x.ProductIndicator = y.ProductIndicator
and x.ProductType = y.ProductType
where x.ProductIndicator = 'D'
group by x.ProductType
order by x.ProductType
Click on the App Button (aka: "Drawer" ) -- That's the key with the multiple squares, click on menu , select view type, select alphabetical grid.
Open up an MSDOS command window. Type :
The id, path, user name, loc# for the file will show up in a text list. Once you find the file you want unlock, you'll need to remember the id. To unlock the file, go back to the MSDOS command window. Type:
net file 99/close (where 99 = file id)
On a windows server there are 2 other ways:
1. From an MSDOS command window type: Openfiles.exe /query /s YOUR_SERVER_NAME
2. Server Manager>Roles>File Services> Share and Storage Management (right click on SaSM) >Manage Open File
We've all been there-- like -- where's that offline htm file i bothered to save last week ... oh I think it was blue something... or was it something blue?
find ../ -name '*blue*.htm*' -print
If you want to keep it in an output file to sort through later while you do something else:
find ../ -name '*blue*.htm*' -print > $HOME/ foundBlue.txt
Try holding down the Menu and Selector (push-button circle in the center) down at the same time for at least 2 seconds.
The simplest answer is because the iPOD software detects that it is unsafe (read: data loss) for your iPOD, Computer or both if you were to disconnect the cable without ejecting the device first.
Here's what to do:
On the Mac--
- Click on the Finder icon
- Pick the iPOD icon.
- Navigate to the File menu--select Eject iPOD
On a Windows OpSys device--
- On the Start menu, click Computer (e.g. Windows 7).
- Right-click on the drive/device letter or iPOD icon (read: the icon doesn't always appear)
- Select Eject.
The message should go away while you're still plugged in. You should be able to charge and listen at the same time! :)
One convenient way is to make use of the template feature (aka: Template Explorere) in SSMS.
1. Navigate to the View menu in SSMS
2. Select Template Explorer->right click on SQL Server Tempaltes.
3. Click New and create folder; use to add/edit templates.
For Windows 7:
1. Right click any blank area on your desktop.
2. Left click Personalize->Display Settings. A window will open that shows a monitor.
3. Navigate to Change Display Settings. A new window will appear showing 2 monitors.
4. Click Identify Monitors. When the monitor you are on is the main monitor, you will see "This is currently your main display" under Multiple displays. To change this, click on the other monitor and check the box that says "Make this my main display". Click Apply.
5. If you want to change how the mouse drags from right to left/left to right, click and drag the right hand monitor left
to the left of the original left monitor and release the drag. That will change the positions of the monitors so that the mouse
motion will be the way you want them.
As with most questions asked about monitoring/assessing/administering MS SQL Server installations, the answer is "it depends".
There are many other blogs/resources/etc. online that can get into the specifics--think of this mini-blog as a snake-bit kit! :) Overall, to get to a list of objects that fall under the DMV (Dynamic Management Views) category, type this:
-- This will show you the views and the functions of all dmv objects
SELECT name, type, type_desc
WHERE name LIKE 'dm_%'
-- and type = 'V'
ORDER BY name
Here are a few useful DMVs to get started with...
-- Query Plans
-- stats about cached query plans
select * from sys.dm_exec_query_stats
-- identifies query plans that are cached
select * from sys.dm_exec_cached_plans
select * from sys.dm_io_pending_io_requests
select * from sys.dm_io_virtual_file_stats(null,null) -- // stats for all data and log files
-- lists active user/internal task connects
select * from sys.dm_exec_sessions
-- established connects
select * from sys.dm_exec_connections
-- lists info about all reqs executing
select * from sys.dm_exec_requests
You're really looking of the modify_date in the sys.objects
table where the type is either a stored proc or a function. This works on a database by database level -- to elevate this search to the server level, you'll have to use the loop sproc sp_msforeachdb
SELECT name, create_date, modify_date
WHERE type = 'P' -- change 'P' to 'FN' if you're looking for a function
and modify_date between cast('2013-09-10' as date) and cast('2013-09-20' as date)
In t-sql/mssql, if you have a known NULL value you can issue a statement like:
ISNULL(BirthDate,'1/1/1970 12:00:00 AM') as BirthDate
The ISNULL function is replacing any nulls found in the BirthDate column to a default value of 1/1/1970.
In other situations, you may not have just NULL values, but other possibilities as well.
ISNULL(BirthDate,'1/1/1970 12:00:00 AM') as BirthDate,
WHEN BusinessPhone IS NULL OR BusinessPhone = ''
END as BusinessPhone
The case statement is evaluating the value found for the BusinessPhone column. If the value is NULL or set to '', then the default value is Unknown, else if the value isn't null or set to '', then retain the value for the BusinessPhone column found.
If you're seeing this error, or a similar access denied
error you'll need to have your windows account given DCOM permissions. DBAs generally have the ability to add you.
If you're a DBA and want to add a developer to be able to connect to the SSIS services to deploy packages here's a quick punch list:
- Logon to the target SQL Server. Go to Start->Run type lusrmgr.msc
- In the Local Users and Groups dialog box, click Groups->Ditributed COM users
- Once in the Distributed COM users properties dialog box, click Add
- Select the User click OK
- Go back to Start->Run type dcomcnfg
- In the Component Services dialog box, drill down to Component Services->Computers->MyComputer
- Under DCOM Config, right click MsDtsServer, click Properties
- In MsDtsServer100 Properties dialog box, click Security tab
- Under Launch and Activate Permissions, go to Customize->Edit
- Under Launch Permissions click Add
- Under Select Users or Groups, type the user name, click OK
- Under Permissions for the user, Allow or check the checkbox for all 4 (local,remote launch/activation)
- Click OK. Do steps 11-12 for Access Permissions.
This answer depends on what version of SQL you're running. A FETCH clause will work for all. Here's an example:
WHERE FLBILC = 'CMD'
ORDER BY FLBILC
FETCH FIRST 10 ROW ONLY;
The equivalent in T-SQL would be:
SELECT TOP 10
WHERE FLBILC = 'CMD';
This happens when you're in the SSMS gui making changes to the table that either affect the behavior of an index, cause existing data to be truncated/nulled, etc. This can also happen you try to change the order of columns, or change datatypes.
If your credentials allow it, you can get past this message in order to truly shoot yourself in the foot! :)
- Navigate to Tools --> Options
- Expand Desingers
- Click on Table and Database Designers
- Check the box Prevent Saving changes that require table to be re-created.
The microsoft integration service is secure by default. The DBA has to grant access to the service in order for it to connect successfully through ssms.
To grant access to the Integration Services service
Run Dcomcnfg.exe. Dcomcnfg.exe provides a user interface for modifying certain settings in the registry.
In the Component Services dialog, expand the Component Services > Computers > My Computer > DCOM Config node.
Right-click Microsoft SQL Server Integration Services 11.0, and then click Properties.
On the Security tab, click Edit in the Launch and Activation Permissions area.
Add users and assign appropriate permissions, and then click Ok.
Repeat steps 4 - 5 for Access Permissions.
Restart SQL Server Management Studio.
Restart the Integration Services Service.
The download for this workbench is large--somewhere around 1.2 gb. Finding the install exe for linux or windows isn't clear. Basically this download appears to be from a 2 disk distributable set of *.ISO files. Ignore all the distraction scripts in the core directory. Delve into \ibm_ds410_lin64
(I downloaded the 64 bit version) . Look for a directory called Disk1
. There you will find the installer images for Windows and Linux.
Here's a visual image of what the directory will look like.
I work with BizTalk (BTS) and SSIS frequently. In one of my environments, whenever I've programmed in BTS, then jump back to SSIS, the SSIS toolbox is missing in action.
Here's what I do to solve the problem in that environment:
- Save the application and close Visual Studio.
- Go your AppData\Local\Microsoft\VisualStudio\[whatever version]
- Rename the *.tdb files there to something else like *.tdb.x
- Open Visual Studio (Note: You will see the progress status bar re-initializing all available toolboxes.)
- Open the application.
- On the canvas, navigate to a space without an annotation or a component.
- Right Click and select SSIS Toolbox.
Update: I recently upgraded from vs2010 to vs2012 in another environment without a biztalk installation-- in this case, when the toolbox wasn't visible, I just went to the canvas, did a right click, selected on SSIS Toolbox and that solved the issue. Try this action first. This may be all you need to do to resolve this issue in your environment.
There are 2 ways to do this, the first is to query the BizTalkDBVersion table:use [BizTalkMgmtDb]
SELECT DatabaseMajor, DatabaseMinor,ProductBuildNumber, ProductRevision
Here is a list of possible BizTalk versions (CUP = cumulative update package, SP = service pack) :
The second way is to follow these steps:
- Click Start, click Run, type regedt32, and then click OK.
- Once the window is up, navigate to HKEY_LOCAL_MACHINE, then SOFTWARE, then Microsoft, then BizTalk Server, and finally open 3.0.
This is what you should see: