Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
lily_wibisana
Starting Member
29 Posts |
Posted - 2008-05-14 : 10:54:07
|
Hi,I need to create a report to display customer name start with certain name. (enter customer name : ava). And all the customer name start ava will show up.In my dataset in Reporting Services I put :SELECT custname FROM CustomerWHERE custname LIKE ‘%’ + @CustNmThank you so much for your help. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-14 : 13:11:51
|
What is your question?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-14 : 14:05:31
|
just use query SELECT custname FROM CustomerWHERE custname LIKE @CustNm + ‘%’and run it in data tab. the grid gets populated. just refresh it by clicking button on top. Automatically CustNm will added as a parameter to report. Now go to layout tab and design your report using fields from dadaset (drag & drop from dataset pane on left). Go to preview tab. It will ask for value of CustNm. ENter a value and click view report to see report. |
|
|
lily_wibisana
Starting Member
29 Posts |
Posted - 2008-05-15 : 08:33:35
|
Hi Visakh16,Thank you so much. It worked. I did it wrong before. I put the wildcard at the front.Once again thank you a millioooon. |
|
|
lily_wibisana
Starting Member
29 Posts |
Posted - 2008-05-16 : 09:58:10
|
The query above in dataset work fine. However, it just displayed the data with customer name start with “A“ as follows. A & BA AbyThe customer name start with A without space next to first character weren’t displayed. (Arby, Art, etc)I changed the query a bit as follows,Select CustName From CustomerWHERE CustName LIKE RTRIM(@CustNm) + ‘%’But it didn’t work either. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-16 : 11:13:00
|
What data type is @CustNm?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
|
|
lily_wibisana
Starting Member
29 Posts |
Posted - 2008-05-20 : 08:34:14
|
Customer Name, and the parameter is string/vachar. |
|
|
|
|
|