Monday, March 26, 2012
getting left _
I must get all the left part of a columns part1_part2
I dont know how many characters
something like :
UPDATE Users SET Users.Info = left(Users.name, _ ? or split('_'))
in that case Users.name = part1
i must update only the one with a '_' and do nothing for the others
thank youTry variations of these to get what you want:
declare @.Name varchar(50)
set @.Name = 'Part1Part2'
select left(@.Name, charindex('_', @.Name + '_')-1)
select substring(@.Name, charindex('_', @.Name + '_')+1, 50)
...or if the names are more complex (such as including middle names, initials, or titles), I have a name splitting function I can give you.|||thank you BlindMan
but the name of the column is Users.Name and part1_part2 was an exemple of value
in that exemple i must get part1
it could be werfewgf fff jjj_rgfregreg
and in that case i must get werfewgf fff jjj
allways the left part of '_'|||with select substring(Users.Name, charindex('_', Users.Name + '_')+1, 50) FROM Users
I get exactly the right part
the left will be great :-)
but I get all even if there is no '_'|||Can you supply some sample data and what the expect result is suppose to be?
My esp usb port is clogged|||sample data >> expect result
wefwefqrwf_hhhh >> wefwefqrwf
fff jj ff_rgdefrhbg >> fff jj ff
acacac145 i4_kk >> acacac145 i4
dddd >> no result, I dont take it there is no _ in the sample data
thanks Brett
Monday, March 19, 2012
Get value of 10 textboxes to decide footer color
If I have the 10 textboxes in my footer with a value of "X" (from an IIF() expression), then I would like to alert the users and have the footer a different color.
I'm trying to get the value of the textbox, but keep getting an error of it being undeclared. I'm trying different syntax, but can't get it to work.
Here's the code:
=
IIF(
textbox11 ="X" or textbox15="X" or textbox19="X" or textbox27="X" or textbox23 = "X" or textbox31 = "X" or textbox35 = "X" or textbox39 = "X" or textbox43 = "X" or textbox47 = "X"
,"Gainsboro","Transparent")
How do you accomplish this in RS for SQL 2000?
Jason|||You need to use the ReportItems collection:
IIF(
ReportItems!textbox11.Value ="X" or ReportItems!textbox15.Value="X" or ReportItems!textbox19.Value="X" or ReportItems!textbox27.Value="X" or ReportItems!textbox23.Value = "X" or ReportItems!textbox31.Value = "X" or ReportItems!textbox35.Value = "X" or ReportItems!textbox39.Value = "X" or ReportItems!textbox43.Value = "X" or ReportItems!textbox47.Value = "X"
,"Gainsboro","Transparent")|||That seems to get me closer, but it still doesn't get me past the scope issue. I've moved my post to a seperate thread with a more detailed description of what I'm trying to do.
Jason
Sunday, February 26, 2012
Get report in Excel
I've made C# winform application where the user can enter it's parameters (I did this so I can do some inputcontrol on the users parameters which I can't in reportviewer cause it's Closed Source).
Now when the user presses the button Get report in Excel. The application should pass the parameters to the SQL statement and complete this. Then the report should be exported to Excel and Excel should start and show me the report.
All this should work behind the scenes and the user should just get the report in Excel. I've added the Web Reference from the report server to my project but I can't seem to find the correct method.
thanks in advance
Hello,
Have a look at the ReportExecutionService class for RS 2005:
http://msdn2.microsoft.com/en-US/library/microsoft.wssux.reportingserviceswebservice.rsexecutionservice2005.reportexecutionservice(SQL.90).aspx
-Chris
Sunday, February 19, 2012
Get OS Group membership
Im using the 'xp_cmdshell' to know all users that belong to the local
administrators group and i'm using the 'net use localgroup' to get the output
into my report.
Here is the code and the Output:
set nocount on
exec xp_cmdshell 'net use localgroup'
go
set nocount off
OUTPUT:
output
--
Alias name administrators
Comment Administrators have..
NULL
Members
NULL
--
Administrator
DOMAINXXX\Domain Admins
DOMAINXXX\usera
DOMAINXXX\userb
The command completed successfully.
NULL
NULL
Is there any way to avoid lines where appear:
output
--
Alias name administrators
Comment Administrators have..
NULL
and all the information that is not part of the group membership?
Do you know other way to get this information?
Thanks,
Best regardsIf the builtin\administrators group still has a login in SQL
Server (it is by default but you could remove it),
you can get the members of the local admin group with:
EXEC xp_logininfo 'BUILTIN\Administrators', 'MEMBERS'
Another would be using openquery with ADSI:
INFO: Performing a SQL Distributed Query by Using ADSI
http://support.microsoft.com/?id=299410
-Sue
On Fri, 11 Feb 2005 09:53:03 -0800, "CC&JM"
<CCJM@.discussions.microsoft.com> wrote:
>Hello,
>Im using the 'xp_cmdshell' to know all users that belong to the local
>administrators group and i'm using the 'net use localgroup' to get the output
>into my report.
>Here is the code and the Output:
>set nocount on
>exec xp_cmdshell 'net use localgroup'
>go
>set nocount off
>OUTPUT:
>output
>
>--
>Alias name administrators
>Comment Administrators have..
>NULL
>Members
>NULL
>--
> Administrator
> DOMAINXXX\Domain Admins
> DOMAINXXX\usera
> DOMAINXXX\userb
>The command completed successfully.
>NULL
>NULL
>Is there any way to avoid lines where appear:
>output
>--
>Alias name administrators
>Comment Administrators have..
>NULL
>and all the information that is not part of the group membership?
>Do you know other way to get this information?
>Thanks,
>Best regards
>
Get OS Group membership
Im using the 'xp_cmdshell' to know all users that belong to the local
administrators group and i'm using the 'net use localgroup' to get the output
into my report.
Here is the code and the Output:
set nocount on
exec xp_cmdshell 'net use localgroup'
go
set nocount off
OUTPUT:
output
Alias name administrators
Comment Administrators have..
NULL
Members
NULL
Administrator
DOMAINXXX\Domain Admins
DOMAINXXX\usera
DOMAINXXX\userb
The command completed successfully.
NULL
NULL
Is there any way to avoid lines where appear:
output
Alias name administrators
Comment Administrators have..
NULL
and all the information that is not part of the group membership?
Do you know other way to get this information?
Thanks,
Best regards
If the builtin\administrators group still has a login in SQL
Server (it is by default but you could remove it),
you can get the members of the local admin group with:
EXEC xp_logininfo 'BUILTIN\Administrators', 'MEMBERS'
Another would be using openquery with ADSI:
INFO: Performing a SQL Distributed Query by Using ADSI
http://support.microsoft.com/?id=299410
-Sue
On Fri, 11 Feb 2005 09:53:03 -0800, "CC&JM"
<CCJM@.discussions.microsoft.com> wrote:
>Hello,
>Im using the 'xp_cmdshell' to know all users that belong to the local
>administrators group and i'm using the 'net use localgroup' to get the output
>into my report.
>Here is the code and the Output:
>set nocount on
>exec xp_cmdshell 'net use localgroup'
>go
>set nocount off
>OUTPUT:
>output
>
>--
>Alias name administrators
>Comment Administrators have..
>NULL
>Members
>NULL
>--
> Administrator
> DOMAINXXX\Domain Admins
> DOMAINXXX\usera
> DOMAINXXX\userb
>The command completed successfully.
>NULL
>NULL
>Is there any way to avoid lines where appear:
>output
>--
>Alias name administrators
>Comment Administrators have..
>NULL
>and all the information that is not part of the group membership?
>Do you know other way to get this information?
>Thanks,
>Best regards
>
Get OS Group membership
Im using the 'xp_cmdshell' to know all users that belong to the local
administrators group and i'm using the 'net use localgroup' to get the outpu
t
into my report.
Here is the code and the Output:
set nocount on
exec xp_cmdshell 'net use localgroup'
go
set nocount off
OUTPUT:
output
Alias name administrators
Comment Administrators have..
NULL
Members
NULL
--
Administrator
DOMAINXXX\Domain Admins
DOMAINXXX\usera
DOMAINXXX\userb
The command completed successfully.
NULL
NULL
Is there any way to avoid lines where appear:
output
--
Alias name administrators
Comment Administrators have..
NULL
and all the information that is not part of the group membership?
Do you know other way to get this information?
Thanks,
Best regardsIf the builtin\administrators group still has a login in SQL
Server (it is by default but you could remove it),
you can get the members of the local admin group with:
EXEC xp_logininfo 'BUILTIN\Administrators', 'MEMBERS'
Another would be using openquery with ADSI:
INFO: Performing a SQL Distributed Query by Using ADSI
http://support.microsoft.com/?id=299410
-Sue
On Fri, 11 Feb 2005 09:53:03 -0800, "CC&JM"
<CCJM@.discussions.microsoft.com> wrote:
>Hello,
>Im using the 'xp_cmdshell' to know all users that belong to the local
>administrators group and i'm using the 'net use localgroup' to get the outp
ut
>into my report.
>Here is the code and the Output:
>set nocount on
>exec xp_cmdshell 'net use localgroup'
>go
>set nocount off
>OUTPUT:
>output
>
>--
>Alias name administrators
>Comment Administrators have..
>NULL
>Members
>NULL
>--
> Administrator
> DOMAINXXX\Domain Admins
> DOMAINXXX\usera
> DOMAINXXX\userb
>The command completed successfully.
>NULL
>NULL
>Is there any way to avoid lines where appear:
>output
>--
>Alias name administrators
>Comment Administrators have..
>NULL
>and all the information that is not part of the group membership?
>Do you know other way to get this information?
>Thanks,
>Best regards
>