Windows Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 26 April 2011

Run a SCCM Web Report Query in SQL Mgt Studio

Posted on 19:05 by Unknown

During the course of diagnosing a (possible) bug in a particular SCCM 2007 R2 SP2 web report, I did what I usually do: copy the SQL statement from the report definition into SQL Server Management Studio (SSMS) and run it as an ad hoc query.  Someone asked how to do this because they run into problems with parameterized queries.  Actually, they probably asked me to explain this so I would appear nerdier than they are.  Well, it's really easy, sort of.

First, in the SCCM Admin console, open the properties for the web report, select all the SQL query code and copy it to the clipboard.  Open SSMS, expand the databases and select the SCCM database and click New Query.  Paste the code into the editor window.  Look for all the @variable references in the query.  For each one, add a SQL scalar variable declaration and assign it a value using the following syntax:

Declare @variableName DataType(size)

The trick is knowing the type and size of the appropriate variable.  The easy way to do this is in SSMS is to find the view or table, expand it, then expand the "Columns" collection and look at the column properties.   For example, the CollectionID column for most tables/views is VarChar(8) so if your parameterized query is referencing a Collection ID value, it might look like this…

USE SCCM_ABC

Declare @collID Varchar(8) = 'SMS00001'

(Note: The "ABC" above should be replaced with your 3-char site code).  As soon as the rest of the variables in your SQL code are declared, you should be able to click the Execute link and run the query directly against the data source in SQL Server.  If it runs and displays results, jump out of your chair and scream "IN YO FACE!!!" directly into the face of your nearest co-worker.  They love that.

Before you flip out and spit your bong water all over the computer screen in disgust, please know this:

1. I know there are other ways to do this and this is not the only (or best) way.

2. I know it's dangerous to tinker in SQL Server with SCCM tables.  Driving is dangerous too.  People die from falling down stairs every day also.  My middle name is Danger.  Actually, it's Michael, but whatever.  It can be dangerous to drive while tinkering with SQL SCCM tables, especially on a bicycle.  So, I'm not being that dangerous am I.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in config manager, programming, sccm, sql server | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Voting Time: Help Me Out?
    I need to get a better view of how I should manage this blog if I'm going to keep at it. I'd like to know how you typically discover...
  • A World Without Competition
    Try to imagine what things would be like today had there not been fierce competition in certain key parts of our world.  I’ll give you some ...
  • Book Update
    I posted some gibberish a few weeks ago about another book project.  Well, I'm getting close to wrapping it up, so I thought I'd go ...
  • Cost
    Software technology, like any technology, provides a means to solving problems.  Some big. Some small.  Some that help.  Some that hurt.  An...
  • Windows 7: Default User vs All Users
    A lot of confusion seems to occur with understanding the difference between the "Default User" profile, and the "All Users...
  • Time to Give Props
    With the ever-expanding volume and breadth of information on the Internet today, it's easy to focus on my own thoughts, experiences, ide...
  • Table of Contents (Preliminary)
    Here's the preliminary Table of Contents for my new book "The AutoCAD Network Administrator's Bible - 2013 Edition".  I...
  • The Nicest IT and IT Vendor Folks I Know
    I've ranted many times before how it's unfair to "hate" an entire company, without providing a rationale for it based on s...
  • Windows 8
    Two small, yet irritating things, that I hope Windows 8 addresses with respect to Windows 7: Being able to put the Recycle Bin in the S...
  • Stupid Assumptions
    After years of watching sci-fi TV shows, movies, etc. it's finally come to a point where even the so-called brightest of our authors and...

Categories

  • a
  • activation
  • active directory
  • advertising
  • agile
  • agility
  • amazon
  • american
  • apple
  • application virtualization
  • applications
  • art
  • articles
  • asp
  • augi
  • authors
  • autocad
  • AutoCAD Autodesk
  • autodesk
  • autolisp
  • automation
  • automotive
  • backups
  • batch
  • beer
  • beta
  • blackberry
  • blogs
  • bongloads
  • book
  • books
  • Books writing kindle amazon technology business projects
  • browsers
  • business
  • cad
  • career
  • certification
  • chrome
  • city government
  • civilization
  • cloud services
  • cmd
  • cmmi
  • comedy
  • command
  • community
  • computers
  • conferences
  • config manager
  • consultants
  • consulting
  • contracting
  • cranium drainium
  • crapware
  • culture
  • data center
  • data mining
  • databases
  • deployment
  • directx
  • DLL
  • domains
  • dumb
  • earth
  • economy
  • editor
  • education
  • election
  • elections
  • employment
  • engineering
  • entertainment
  • environment
  • error monitoring
  • events
  • exchange
  • facebook
  • family
  • firefox
  • flexnet
  • fud
  • fun
  • funny
  • games
  • gary vaynerchuk
  • gmail
  • google
  • government
  • group policy
  • hampton roads
  • health
  • history
  • holidays
  • home
  • html5
  • humor
  • hyper-v
  • iis
  • industry
  • infrastructure
  • installation
  • installshield
  • internet
  • internet explorer
  • interviews
  • jobs
  • jtbworld
  • kindle
  • kixtart
  • lab setup
  • languages
  • ldap
  • learning
  • legal
  • licensing
  • life
  • lifecycle
  • linux
  • lisp
  • logging
  • management
  • manufacturing
  • marketing
  • markets
  • mdop
  • mdt
  • medical
  • messaging
  • microsoft
  • microsoft access
  • military
  • mountains
  • movies
  • mozilla
  • music
  • nature
  • network administration
  • news
  • nook
  • nothing
  • office
  • open source
  • openoffice
  • opera
  • operating systems
  • oracle
  • osx
  • packaging
  • patches
  • people
  • photos
  • podcasts
  • policy
  • politics
  • powershell
  • predictions
  • process automation
  • products
  • programming
  • projects
  • psychology
  • publishing
  • rail
  • reading
  • registry
  • religion
  • reporting
  • reviews
  • rsat
  • rss
  • safari
  • safety
  • sales
  • satire
  • sccm
  • scheduling
  • science
  • scripting
  • search
  • security
  • servers
  • services
  • sharepoint
  • shopping
  • sms
  • social stuff
  • society
  • softgrid
  • software assurance
  • software deployment
  • software development
  • software packaging
  • sony
  • speaking
  • sports
  • sql express
  • sql server
  • statistics
  • Statistics news marketing
  • steve jobs
  • stories
  • stuff
  • stupidity
  • symantec
  • sysinternals
  • system center
  • systems architecture
  • t-sql
  • taxes
  • technet
  • technical support
  • technology
  • TED
  • ted talks
  • testing
  • textpad
  • thoughts
  • traffic
  • training
  • transportation
  • travel
  • troubleshooting
  • tutorials
  • twitter
  • ubuntu
  • unattend
  • unemployment
  • updates
  • upfront ezine
  • utilities
  • vacation
  • vba
  • vbscript
  • video
  • virginia
  • virginia beach
  • virtualization
  • visual lisp
  • vmware
  • vmware server
  • voting
  • war
  • weather
  • web
  • web browsers
  • web development
  • web sites
  • windows
  • windows 7
  • windows live
  • windows server
  • windows server 2012
  • windows8
  • winpe
  • wise
  • wmi
  • work
  • writing
  • ws08
  • wsus
  • wwa
  • x64
  • xml
  • ze frank

Blog Archive

  • ►  2013 (37)
    • ►  October (1)
    • ►  September (5)
    • ►  August (8)
    • ►  July (2)
    • ►  June (4)
    • ►  May (4)
    • ►  April (2)
    • ►  March (2)
    • ►  February (8)
    • ►  January (1)
  • ►  2012 (120)
    • ►  December (14)
    • ►  November (12)
    • ►  October (10)
    • ►  September (7)
    • ►  August (3)
    • ►  July (2)
    • ►  June (6)
    • ►  May (6)
    • ►  April (20)
    • ►  March (16)
    • ►  February (18)
    • ►  January (6)
  • ▼  2011 (343)
    • ►  December (15)
    • ►  November (23)
    • ►  October (27)
    • ►  September (35)
    • ►  August (29)
    • ►  July (17)
    • ►  June (23)
    • ►  May (20)
    • ▼  April (38)
      • Possibilities
      • Windows Web Admin - Application Settings
      • Windows Web Admin build 2011.04.28.001 posted
      • Setting up Windows Web Admin on IIS7
      • WWA Build Update
      • Cheaper Kindle with Ads?
      • Imaging Computers with MDT 2010 and AutoCAD 2012
      • Deployment Headaches
      • When to SnapShot your VMware Guests
      • Windows Web Admin 2011.04.26.001
      • Run a SCCM Web Report Query in SQL Mgt Studio
      • AutoCAD 2012 via MDT 2010
      • Windows Web Admin: Moving to a New Location
      • Windows Web Admin: Build 2011.04.22.001
      • Acad2012DX.msi - DirectX Installer for AutoCAD 201...
      • MDT 2010
      • DirectX installer for AutoCAD 2012
      • Dear Software Developers
      • Facebook
      • AutoCAD 2012 Deployment, .NET 4 and SCCM
      • Windows Web Admin: build 2011.04.19.001
      • Script Tip of Day: NET HELPMSG
      • Empowering
      • WSUS Headaches and a Cure
      • What's Old is New…
      • 5 IT Resume Tips
      • Top 10 Mistakes Programmers Make
      • Technical Difficulties
      • 10 Lessons
      • Moments
      • RSAT for Windows 7 SP1
      • Shout Out - Abs Of Beer TV Blogcast
      • I hope this isn't a bad omen?
      • Windows Web Admin (Final)
      • The CAD Cloud. Finally. Citrix and AutoCAD 2012
      • Deploying AutoCAD with MDT 2010
      • Estimation 101: Migrating an MS-Access DB to SQL ...
      • Holy Cow! Strep and Couch Fatigue
    • ►  March (61)
    • ►  February (54)
    • ►  January (1)
Powered by Blogger.

About Me

Unknown
View my complete profile