Showing posts with label fields. Show all posts
Showing posts with label fields. Show all posts

Friday, March 23, 2012

Little tiny squares

Hi just imported a bunch of fields from a text file and now have a bunch of little squares iat the end of each field, I assume that they are linebreaks or carriage returns, what is the easiest way to get rid of these?
D--You can use the replace command.

Eg.

declare @.string varchar(100)
set @.string='ABD'

select replace(@.string,'D','C')

Play around with it and you know how to use it for your problem.|||Originally posted by Patrick Chua
You can use the replace command.

Eg.

declare @.string varchar(100)
set @.string='ABD'

select replace(@.string,'D','C')

Play around with it and you know how to use it for your problem.

You should use it in an Update statement:

UPDATE <TableName> Set <FieldName> =
replace(<FieldName>, CHAR(x), '')

x is the ASCII code to identify your quares; try 10 (= CR), or 13 (= LF)|||worked like a charm thanks char(13) was itsql

Friday, February 24, 2012

List Filtering NOT Working

I have a Report where i want to show in a DataList only those values Filtered by one of the fields of my dataset. I want to show a Date value ONLY if another column value in that row in my dataset = "IN".

But nothing seems to happen here. No records are shown. It's like the condition is never true.

Steps:

1. I drag a DataList

2. I drag a DatasetField inside the DataList (automatically creates a textbox)

3. Right Click on the Datalist, Properties, then Filter Tab

I use the following statement on the Filter tab

=Cstr(Fields!TransactionType.Value) Like "IN"

or

=Cstr(Fields!TransactionType.Value) = "IN"

it doesnt work at all.

Does anyone knows what's going on?

Thanks

Jose

I've noticed that in filtering sometimes, in fact in most cases, I have to explicitly cast each side to the correct data type. So in your case

Expression: Operator: Value:

=Cstr(Fields!TransactionType.Value) = = Cstr("IN")

Hope this helps.

|||

PERFECTLY FINE

THANK YOU

Monday, February 20, 2012

List All Employee under my control

Hi,

I have a table employee with two fields (empId, and Supervisor)

what i want is to list all employees under a given empId

example

Table: Employee
EmpId, Supervisor
1, Null
2, 1
3, 1
4, 2
5, 2
6, 3
7, 4
8, 4
9, 5
10, 5
11, 6
12, 6
13, 6

request of the employees under control of 4?
Result should be: 4, 7, 8

request of the employees under control of 2?
Result should be: 2, 4, 5, 7, 8, 9 , 10

request of the employees under control of 3?
Result should be: 3, 6, 11, 12 , 13

thanks a lotsdeclare @.SupervisorID int
set @.SupervisorID = 3

declare @.Subordinates table (EmpID int)

insert into @.Subordinates (EmpID)
select EmpID
from Employees
where Supervisor = @.SupervisorID

while @.@.Rowcount > 0
insert into @.Subordinates (EmpID)
select Employees.EmpID
from Employees
inner join @.Subordinates Subordinates on Employees.Supervisor = Subordinates.EmpID
where not exists(select * from @.Subordinates CurrentEmpIDs where Employees.EmpID = CurrentEmpIDs.EmpID)

select * from @.Subordinates

blindman