Monday, April 22, 2013

[T-SQL] Find Serial number in sql string

[T-SQL] Find Serial number in sql string


Find Serial number in sql string

Posted: 21 Apr 2013 09:19 AM PDT

So i need to query Active directory and get all the computer based on certian OS type, no problem doing this easy, the hard part is I need to extract the serial number out of the info string.This this is what I have started but dont know how to get the rest, I used a charindex to get tot he Sn part but it starts at the semicolon and not the equals part.Create table #TempAD (cn varchar(max), info varchar(max), os varchar(max))Insert #AD (cn, info, os)Select cn, info, operatingSystem from OPENQUERY(ADSI, 'Select cn, info, operatingSystem from ''LDAP://myldap''') where INFO is not null Select cn, info, CharIndex(';SN=', info), os from #ADHere is what the typical data looks like for info, what i need is the SN for each so in these cases554FSL53TFKDQ4664JDL2Sys=Dell Inc.|OptiPlex 760;SN=554FSL5;OS=Ver:6.1.7601,SP:1,Type:1;Form=Desktop;Sys=Dell Inc.|Latitude E6410;SN=3TFKDQ4;OS=Ver:6.1.7601,SP:1,Type:1;Form=Laptop;Sys=Dell Inc.|OptiPlex 760;SN=664JDL2;OS=Ver:6.1.7601,SP:1,Type:1;Form=Desktop;Thank you for the help

Generate SSRS Report and then Email Report from a single Stored Procedure

Posted: 21 Apr 2013 01:46 PM PDT

Can someone please offer assistance? I need to create a Stored Procedure that will generate a SSRS reports a number of times with different parameters and then email them to different individuals listed in another table based on parameters that were used when generating each version of the SSRS Report.Is it possible to generate an SSRS report from a Stored Procedure?

convert tSQL mySQL to MSSQL

Posted: 21 Apr 2013 11:18 AM PDT

Hi Guys need some help with converting this part of a query from MySQL, I need to run this on MSSQL.Select (SUM(if(rating = 5, 1, 0))-SUM(if(RATING < 4, 1, 0)))/SUM(if(RATING > 0, 1, 0))*100 as RECENT_NPS,SUM(if(RATING > 0, 1, 0)) as RECENT_RATINGS, ............

No comments:

Post a Comment

Search This Blog