Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts

Friday, March 30, 2012

how to trim a field value in rss

can any one explain how to trim a value on bothside in rss

for eg:

'asd '

' asd'

i wanna this output 'asd'............

can i give this command

=Format(Fields!company.Value.Trim)

You can use Trim function like this:

Trim(Fields!company.Value)

This will trim both leading and trailing spaces.

Pls mark this post as answer if your problem is solved.

Shyam

Wednesday, March 28, 2012

How to transfer data from one sql server to another sql server 7.0

Dear All
i have small data to transfer, let me explain it,
I have to transfer some small data from head office (sql server) to a branch
office (sql server)
the main objective is that the task should be automated via front end
developed in VB 6.0
The user at head office just choose option from front end to transfer data
and the user at branch office just select option to receive data, the
remainin task should be performed at the back end.
I just want to know the best technique to transfer the data, i have built
same type of solution using foxpro by sending data in text file. as i have
some ideas in my mind that data can be transfered via text file, via access
mdb file etc. etc., but what is the best technique.
please help if u can
Regards
Abdul Hameed
hsbilal@.gmail.comHi Abdul,
I feel the best option for you will be using Data Transformation Servics.
DTS not only helps to transfer data, it also helps to transform data. You
will be able to invoke the DTS package from your Visual Basic Program using
the COM interface provided by DTS.
Thanks & Regards
Shri.DBA
"Abdul Hameed" wrote:

> Dear All
> i have small data to transfer, let me explain it,
> I have to transfer some small data from head office (sql server) to a bran
ch
> office (sql server)
> the main objective is that the task should be automated via front end
> developed in VB 6.0
> The user at head office just choose option from front end to transfer data
> and the user at branch office just select option to receive data, the
> remainin task should be performed at the back end.
> I just want to know the best technique to transfer the data, i have built
> same type of solution using foxpro by sending data in text file. as i have
> some ideas in my mind that data can be transfered via text file, via acces
s
> mdb file etc. etc., but what is the best technique.
> please help if u can
> Regards
> Abdul Hameed
> hsbilal@.gmail.com
>
>|||Hi
How often users can click to transfer?
What is db's size?
Also , look at backup/restore option
"Abdul Hameed" <hsbilal@.gmail.com> wrote in message
news:u1LXijasEHA.1276@.TK2MSFTNGP12.phx.gbl...
> Dear All
> i have small data to transfer, let me explain it,
> I have to transfer some small data from head office (sql server) to a
branch
> office (sql server)
> the main objective is that the task should be automated via front end
> developed in VB 6.0
> The user at head office just choose option from front end to transfer data
> and the user at branch office just select option to receive data, the
> remainin task should be performed at the back end.
> I just want to know the best technique to transfer the data, i have built
> same type of solution using foxpro by sending data in text file. as i have
> some ideas in my mind that data can be transfered via text file, via
access
> mdb file etc. etc., but what is the best technique.
> please help if u can
> Regards
> Abdul Hameed
> hsbilal@.gmail.com
>
>|||Dear
Thankx for reply
I can use the DTS but how i will pass certain paramaters to dts package, as
i have to get the data based on certain paramaters.
Anyway i found another solution, please let me know will it be appropriate.
To Export data:
I will make a stored procedures which will accept certain paramaters, this
proce will create a linked server (access mdb)
then it will get data from sql server and update the mdb file, and at the
end the linked server will be destory, i will call this procedure form my vb
app with paramaters.
To Import data:
i will make a same stored procedure with reverse technique i.e. reading data
from mdb file and update sql server data
Kindly give ur comments.
Regards
"Shri.DBA" <ShriDBA@.discussions.microsoft.com> wrote in message
news:D4AD3EAE-BFC5-4DC9-BFD3-8050CD48826D@.microsoft.com...
> Hi Abdul,
> I feel the best option for you will be using Data Transformation Servics.
> DTS not only helps to transfer data, it also helps to transform data. You
> will be able to invoke the DTS package from your Visual Basic Program
using[vbcol=seagreen]
> the COM interface provided by DTS.
> Thanks & Regards
> Shri.DBA
> "Abdul Hameed" wrote:
>
branch[vbcol=seagreen]
data[vbcol=seagreen]
built[vbcol=seagreen]
have[vbcol=seagreen]
access[vbcol=seagreen]|||See inline
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Abdul Hameed" <hsbilal@.gmail.com> wrote in message
news:O5uAQbdsEHA.2560@.tk2msftngp13.phx.gbl...
> Dear
> Thankx for reply
> I can use the DTS but how i will pass certain paramaters to dts package,
as
> i have to get the data based on certain paramaters.
> Anyway i found another solution, please let me know will it be
appropriate.
You can create a DTS package, and even save it as a BAS file and include it
in your project, or simply call it using the object model... You can set
global variables and pass in your parameters that way.
> To Export data:
> I will make a stored procedures which will accept certain paramaters, this
> proce will create a linked server (access mdb)
> then it will get data from sql server and update the mdb file, and at the
> end the linked server will be destory, i will call this procedure form my
vb
> app with paramaters.
I wonder if creating the access database isn't overkill... you could simply
use DTS to bcp out the files. or better simply leave the data in the source
database and when the user wishes to import, move the data directly from the
source database to the destination database.

> To Import data:
> i will make a same stored procedure with reverse technique i.e. reading
data
> from mdb file and update sql server data
> Kindly give ur comments.
> Regards
> "Shri.DBA" <ShriDBA@.discussions.microsoft.com> wrote in message
> news:D4AD3EAE-BFC5-4DC9-BFD3-8050CD48826D@.microsoft.com...
Servics.[vbcol=seagreen]
You[vbcol=seagreen]
> using
> branch
> data
> built
> have
> access
>

How to transfer data from one sql server to another sql server 7.0

Dear All
i have small data to transfer, let me explain it,
I have to transfer some small data from head office (sql server) to a branch
office (sql server)
the main objective is that the task should be automated via front end
developed in VB 6.0
The user at head office just choose option from front end to transfer data
and the user at branch office just select option to receive data, the
remainin task should be performed at the back end.
I just want to know the best technique to transfer the data, i have built
same type of solution using foxpro by sending data in text file. as i have
some ideas in my mind that data can be transfered via text file, via access
mdb file etc. etc., but what is the best technique.
please help if u can
Regards
Abdul Hameed
hsbilal@.gmail.com
Hi Abdul,
I feel the best option for you will be using Data Transformation Servics.
DTS not only helps to transfer data, it also helps to transform data. You
will be able to invoke the DTS package from your Visual Basic Program using
the COM interface provided by DTS.
Thanks & Regards
Shri.DBA
"Abdul Hameed" wrote:

> Dear All
> i have small data to transfer, let me explain it,
> I have to transfer some small data from head office (sql server) to a branch
> office (sql server)
> the main objective is that the task should be automated via front end
> developed in VB 6.0
> The user at head office just choose option from front end to transfer data
> and the user at branch office just select option to receive data, the
> remainin task should be performed at the back end.
> I just want to know the best technique to transfer the data, i have built
> same type of solution using foxpro by sending data in text file. as i have
> some ideas in my mind that data can be transfered via text file, via access
> mdb file etc. etc., but what is the best technique.
> please help if u can
> Regards
> Abdul Hameed
> hsbilal@.gmail.com
>
>
|||Hi
How often users can click to transfer?
What is db's size?
Also , look at backup/restore option
"Abdul Hameed" <hsbilal@.gmail.com> wrote in message
news:u1LXijasEHA.1276@.TK2MSFTNGP12.phx.gbl...
> Dear All
> i have small data to transfer, let me explain it,
> I have to transfer some small data from head office (sql server) to a
branch
> office (sql server)
> the main objective is that the task should be automated via front end
> developed in VB 6.0
> The user at head office just choose option from front end to transfer data
> and the user at branch office just select option to receive data, the
> remainin task should be performed at the back end.
> I just want to know the best technique to transfer the data, i have built
> same type of solution using foxpro by sending data in text file. as i have
> some ideas in my mind that data can be transfered via text file, via
access
> mdb file etc. etc., but what is the best technique.
> please help if u can
> Regards
> Abdul Hameed
> hsbilal@.gmail.com
>
>
|||Dear
Thankx for reply
I can use the DTS but how i will pass certain paramaters to dts package, as
i have to get the data based on certain paramaters.
Anyway i found another solution, please let me know will it be appropriate.
To Export data:
I will make a stored procedures which will accept certain paramaters, this
proce will create a linked server (access mdb)
then it will get data from sql server and update the mdb file, and at the
end the linked server will be destory, i will call this procedure form my vb
app with paramaters.
To Import data:
i will make a same stored procedure with reverse technique i.e. reading data
from mdb file and update sql server data
Kindly give ur comments.
Regards
"Shri.DBA" <ShriDBA@.discussions.microsoft.com> wrote in message
news:D4AD3EAE-BFC5-4DC9-BFD3-8050CD48826D@.microsoft.com...
> Hi Abdul,
> I feel the best option for you will be using Data Transformation Servics.
> DTS not only helps to transfer data, it also helps to transform data. You
> will be able to invoke the DTS package from your Visual Basic Program
using[vbcol=seagreen]
> the COM interface provided by DTS.
> Thanks & Regards
> Shri.DBA
> "Abdul Hameed" wrote:
branch[vbcol=seagreen]
data[vbcol=seagreen]
built[vbcol=seagreen]
have[vbcol=seagreen]
access[vbcol=seagreen]
|||See inline
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Abdul Hameed" <hsbilal@.gmail.com> wrote in message
news:O5uAQbdsEHA.2560@.tk2msftngp13.phx.gbl...
> Dear
> Thankx for reply
> I can use the DTS but how i will pass certain paramaters to dts package,
as
> i have to get the data based on certain paramaters.
> Anyway i found another solution, please let me know will it be
appropriate.
You can create a DTS package, and even save it as a BAS file and include it
in your project, or simply call it using the object model... You can set
global variables and pass in your parameters that way.
> To Export data:
> I will make a stored procedures which will accept certain paramaters, this
> proce will create a linked server (access mdb)
> then it will get data from sql server and update the mdb file, and at the
> end the linked server will be destory, i will call this procedure form my
vb
> app with paramaters.
I wonder if creating the access database isn't overkill... you could simply
use DTS to bcp out the files. or better simply leave the data in the source
database and when the user wishes to import, move the data directly from the
source database to the destination database.

> To Import data:
> i will make a same stored procedure with reverse technique i.e. reading
data[vbcol=seagreen]
> from mdb file and update sql server data
> Kindly give ur comments.
> Regards
> "Shri.DBA" <ShriDBA@.discussions.microsoft.com> wrote in message
> news:D4AD3EAE-BFC5-4DC9-BFD3-8050CD48826D@.microsoft.com...
Servics.[vbcol=seagreen]
You
> using
> branch
> data
> built
> have
> access
>

How to transfer data from one sql server to another sql server 7.0

Dear All
i have small data to transfer, let me explain it,
I have to transfer some small data from head office (sql server) to a branch
office (sql server)
the main objective is that the task should be automated via front end
developed in VB 6.0
The user at head office just choose option from front end to transfer data
and the user at branch office just select option to receive data, the
remainin task should be performed at the back end.
I just want to know the best technique to transfer the data, i have built
same type of solution using foxpro by sending data in text file. as i have
some ideas in my mind that data can be transfered via text file, via access
mdb file etc. etc., but what is the best technique.
please help if u can
Regards
Abdul Hameed
hsbilal@.gmail.comHi Abdul,
I feel the best option for you will be using Data Transformation Servics.
DTS not only helps to transfer data, it also helps to transform data. You
will be able to invoke the DTS package from your Visual Basic Program using
the COM interface provided by DTS.
Thanks & Regards
Shri.DBA
"Abdul Hameed" wrote:
> Dear All
> i have small data to transfer, let me explain it,
> I have to transfer some small data from head office (sql server) to a branch
> office (sql server)
> the main objective is that the task should be automated via front end
> developed in VB 6.0
> The user at head office just choose option from front end to transfer data
> and the user at branch office just select option to receive data, the
> remainin task should be performed at the back end.
> I just want to know the best technique to transfer the data, i have built
> same type of solution using foxpro by sending data in text file. as i have
> some ideas in my mind that data can be transfered via text file, via access
> mdb file etc. etc., but what is the best technique.
> please help if u can
> Regards
> Abdul Hameed
> hsbilal@.gmail.com
>
>|||Hi
How often users can click to transfer?
What is db's size?
Also , look at backup/restore option
"Abdul Hameed" <hsbilal@.gmail.com> wrote in message
news:u1LXijasEHA.1276@.TK2MSFTNGP12.phx.gbl...
> Dear All
> i have small data to transfer, let me explain it,
> I have to transfer some small data from head office (sql server) to a
branch
> office (sql server)
> the main objective is that the task should be automated via front end
> developed in VB 6.0
> The user at head office just choose option from front end to transfer data
> and the user at branch office just select option to receive data, the
> remainin task should be performed at the back end.
> I just want to know the best technique to transfer the data, i have built
> same type of solution using foxpro by sending data in text file. as i have
> some ideas in my mind that data can be transfered via text file, via
access
> mdb file etc. etc., but what is the best technique.
> please help if u can
> Regards
> Abdul Hameed
> hsbilal@.gmail.com
>
>|||Dear
Thankx for reply
I can use the DTS but how i will pass certain paramaters to dts package, as
i have to get the data based on certain paramaters.
Anyway i found another solution, please let me know will it be appropriate.
To Export data:
I will make a stored procedures which will accept certain paramaters, this
proce will create a linked server (access mdb)
then it will get data from sql server and update the mdb file, and at the
end the linked server will be destory, i will call this procedure form my vb
app with paramaters.
To Import data:
i will make a same stored procedure with reverse technique i.e. reading data
from mdb file and update sql server data
Kindly give ur comments.
Regards
"Shri.DBA" <ShriDBA@.discussions.microsoft.com> wrote in message
news:D4AD3EAE-BFC5-4DC9-BFD3-8050CD48826D@.microsoft.com...
> Hi Abdul,
> I feel the best option for you will be using Data Transformation Servics.
> DTS not only helps to transfer data, it also helps to transform data. You
> will be able to invoke the DTS package from your Visual Basic Program
using
> the COM interface provided by DTS.
> Thanks & Regards
> Shri.DBA
> "Abdul Hameed" wrote:
> > Dear All
> > i have small data to transfer, let me explain it,
> > I have to transfer some small data from head office (sql server) to a
branch
> > office (sql server)
> > the main objective is that the task should be automated via front end
> > developed in VB 6.0
> > The user at head office just choose option from front end to transfer
data
> > and the user at branch office just select option to receive data, the
> > remainin task should be performed at the back end.
> >
> > I just want to know the best technique to transfer the data, i have
built
> > same type of solution using foxpro by sending data in text file. as i
have
> > some ideas in my mind that data can be transfered via text file, via
access
> > mdb file etc. etc., but what is the best technique.
> > please help if u can
> > Regards
> > Abdul Hameed
> > hsbilal@.gmail.com
> >
> >
> >
> >|||See inline
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Abdul Hameed" <hsbilal@.gmail.com> wrote in message
news:O5uAQbdsEHA.2560@.tk2msftngp13.phx.gbl...
> Dear
> Thankx for reply
> I can use the DTS but how i will pass certain paramaters to dts package,
as
> i have to get the data based on certain paramaters.
> Anyway i found another solution, please let me know will it be
appropriate.
You can create a DTS package, and even save it as a BAS file and include it
in your project, or simply call it using the object model... You can set
global variables and pass in your parameters that way.
> To Export data:
> I will make a stored procedures which will accept certain paramaters, this
> proce will create a linked server (access mdb)
> then it will get data from sql server and update the mdb file, and at the
> end the linked server will be destory, i will call this procedure form my
vb
> app with paramaters.
I wonder if creating the access database isn't overkill... you could simply
use DTS to bcp out the files. or better simply leave the data in the source
database and when the user wishes to import, move the data directly from the
source database to the destination database.
> To Import data:
> i will make a same stored procedure with reverse technique i.e. reading
data
> from mdb file and update sql server data
> Kindly give ur comments.
> Regards
> "Shri.DBA" <ShriDBA@.discussions.microsoft.com> wrote in message
> news:D4AD3EAE-BFC5-4DC9-BFD3-8050CD48826D@.microsoft.com...
> > Hi Abdul,
> >
> > I feel the best option for you will be using Data Transformation
Servics.
> > DTS not only helps to transfer data, it also helps to transform data.
You
> > will be able to invoke the DTS package from your Visual Basic Program
> using
> > the COM interface provided by DTS.
> >
> > Thanks & Regards
> > Shri.DBA
> >
> > "Abdul Hameed" wrote:
> >
> > > Dear All
> > > i have small data to transfer, let me explain it,
> > > I have to transfer some small data from head office (sql server) to a
> branch
> > > office (sql server)
> > > the main objective is that the task should be automated via front end
> > > developed in VB 6.0
> > > The user at head office just choose option from front end to transfer
> data
> > > and the user at branch office just select option to receive data, the
> > > remainin task should be performed at the back end.
> > >
> > > I just want to know the best technique to transfer the data, i have
> built
> > > same type of solution using foxpro by sending data in text file. as i
> have
> > > some ideas in my mind that data can be transfered via text file, via
> access
> > > mdb file etc. etc., but what is the best technique.
> > > please help if u can
> > > Regards
> > > Abdul Hameed
> > > hsbilal@.gmail.com
> > >
> > >
> > >
> > >
>

Friday, March 9, 2012

how to sum a column depending of another colum into different vars?

Hi all, I am trying to sum a column into different variables depending on another column. Let me explain my self better with an example

DECLARE @.Initial decimal(18,2), @.incomings decimal(18,2), @.outgoings decimal(18,2)

SELECT
@.initial = CASE WHEN type = 1 THEN SUM(amount) END,
@.incomings = CASE WHEN type = 2 THEN SUM(amount) END,
@.outgoings = CASE WHEN type = 3 THEN SUM(amount) END,
FROM Transactions
WHERE date = '05/14/2006' AND STATION = 'apuyinc'
GROUP BY type, amount

What I am trying to do is to sum all of the incomings transactions into @.incomings, all of the outgoing transactions into @.outgoings and the initial transaction into @.initial where
The incoming transactions is type 2,
outgoing transactions is type 3

Thanks for the help

@.puy

Hi, this should work for you:

SELECT
@.initial = SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),
@.incomings = SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),
@.outgoings = SUM(CASE WHEN type = 3 THEN amount ELSE 0 END),
FROM Transactions
WHERE date = '05/14/2006' AND STATION = 'apuyinc'
GROUP BY type, amount

HTH; Jens Suessmeyer.

http://www.sqlserver2005.de
|||

Hi, sorry for the late answer...

Your query just returns almost the same as mine, it just return the value for the initial with the difference that mine return null the other, yours return 0.

Here it is the query I ran and the results

declare @.initial decimal(18,2), @.incomings decimal(18,2), @.outgoings decimal(18,2)

SELECT
@.initial = SUM(CASE WHEN tipo = 1 THEN monto ELSE 0 END),
@.incomings = SUM(CASE WHEN tipo = 2 THEN monto ELSE 0 END),
@.outgoings = SUM(CASE WHEN tipo = 3 THEN monto ELSE 0 END)
FROM Caja
WHERE fecha = '05/14/2006' AND estacion = 'apuyinc'
GROUP BY tipo, monto
select @.initial, @.incomings, @.outgoings

select tipo,monto,fecha,estacion from caja where fecha = '05-14-2006' and estacion = 'apuyinc'

initial incomings outgoings
-- -- --
15000.00 .00 .00

(1 row(s) affected)

tipo monto fecha estacion
- --
1 15000.00 2006-05-14 00:00:00 APUYINC
2 3480.00 2006-05-14 00:00:00 APUYINC
2 3140.00 2006-05-14 00:00:00 APUYINC
2 11010.00 2006-05-14 00:00:00 APUYINC
7 -5000.00 2006-05-14 00:00:00 APUYINC

(5 row(s) affected)

As you can see, it should retrieve 17630 when tipo = 2...

Any other suggestion will be highly appreciate...

thanks,

@.puyinc

P.S. Sorry for changing the language, these were the original column values ;)

|||Yes, we messed up with the variables / or the grouping, if you just want to have the sums in common, not grouped by any column this should be the following:

DROP TABLE #someTable

CREATE TABLE #SomeTable

(

tipo int,

monto int,

fecha datetime,

estacion varchar(100)

)

SELECT * FROM #SomeTable

INSERT INTO #SomeTable

SELECT 1,15000,'2006-05-14 00:00:00','APUYINC'

INSERT INTO #SomeTable

SELECT 2,3480,'2006-05-14 00:00:00','APUYINC'

INSERT INTO #SomeTable

SELECT 2,3140,'2006-05-14 00:00:00','APUYINC'

INSERT INTO #SomeTable

SELECT 2,11010,'2006-05-14 00:00:00','APUYINC'

INSERT INTO #SomeTable

SELECT 7,-5000,'2006-05-14 00:00:00','APUYINC'

SELECT

@.initial = SUM(CASE WHEN tipo = 1 THEN monto ELSE 0 END),
@.incomings = SUM(CASE WHEN tipo = 2 THEN monto ELSE 0 END),
@.outgoings = SUM(CASE WHEN tipo = 3 THEN monto ELSE 0 END)

FROM #SomeTable

WHERE fecha = '05/14/2006' AND estacion = 'apuyinc'

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Thank you for the help, it works now.

I added the "group by" clause in some moment that gave me a syntax error and force me to add it. But now it looks like it is not necesary.