Showing posts with label files. Show all posts
Showing posts with label files. Show all posts

Wednesday, March 28, 2012

Problem with Batch files!

Hi,
I am trying to write a batch file which does the following:
1. Move all the files created on weekdays to be sorted to their respective days folder Example: Files created on Tuesday should be moved to a folder named "Tuesday"(When the batch file is run on Wednesday).
2. Only that particular day's created files should be present in the main directory and the other files should be moved to their respective days(created days) folder!!!!!
Could you please help me out!!!!!
Thanks.
AUse xp_cmdshall with regular dos dir, copy, etc. You can save list of files in folder to temporary or permanent table like this:

create table #tmp(res varchar(700))
insert #tmp
master..xp_cmdshell 'dir myfolder'

Monday, March 26, 2012

problem with attach database

EXEC sp_attach_single_file_db @.dbname = 'mydatabase',
@.physname = 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\'mydatabase'.mdf'

Server: Msg 5180, Level 22, State 1, Line 1
Could not open FCB for invalid file ID 0 in database 'mydatabase'.

Connection Broken

What can I do with such error of my database?
Was my database lost?
Any help would be appreciate!
Best regards,
AdamHi

Does the filename really have quotes in it? ( 'mydatabase'.mdf )

John

"Adam Polech" <polada1@.poczta.onet.pl> wrote in message
news:cd8lbt$fc9$1@.213.17.164.114...
> EXEC sp_attach_single_file_db @.dbname = 'mydatabase',
> @.physname = 'c:\Program Files\Microsoft SQL
> Server\MSSQL\Data\'mydatabase'.mdf'
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 0 in database 'mydatabase'.
> Connection Broken
> What can I do with such error of my database?
> Was my database lost?
> Any help would be appreciate!
> Best regards,
> Adam

Friday, March 9, 2012

problem when installing sql reporting services 2005(encrypt problem)

Hi,

I am trying to install sql reporting services 2005....i am getting this error

“Error : SQL Server Setup cannot install files to the compressed or encrypted folder: C:\Program Files\Microsoft SQL Server\. To continue, make sure that your installation directories are not compressed or encrypted, or specify a different directory, and then run SQL Server Setup again.”…

on the same machine sql server 2000 is also installed

Please help me ..its urgent....

Regards,

Pradeep

You may either have a compress or a EFS encrypted folder. This isn′t allowed in SQL Server 2005. Remove the compressions and / or the encryption and try again.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Problem when field is NULL

I am doing a LEFT JOIN, that should display all files in table a even if
there is no match with table B as far as I know.
The problem is that if the field that joins A with B is NULL then I get no
results, I am trying the following:
SELECT a.Id , a.CaseId , a.EmpId, a.AlienId, a.FirmAddressId, b.FirstNm ,
b.MiddleNm, b.LastNm , b.FirmId, c.Processcatalog , a.MainCase ,
d.MaidenNm
FROM Cases a LEFT JOIN Users as d ON a.EmpId = d.UserId
LEFT JOIN Users as b ON ISNULL (a.AlienId,'0') = b.UserId
INNER JOIN Processcatalog as c ON Process = ProcesscatalogID WHERE
ISNULL (a.CaseID,'') LIKE '%MMColParam%' AND ISNULL (b.LastNm,'') LIKE
'MMColParam1%' AND ISNULL (b.FirstNm,'') LIKE 'MMColParam2%' AND
b.Firmid = 'MMColParam3' AND a.archived LIKE 'MMColParam4' and
a.firmaddressid LIKE 'MMColParam5' and ISNULL(a.firmaddressid,'')LIKE
'MMColParam5' AND ISNULL(d.UserID,'') LIKE 'MMColParam6' AND MainCase IS
NOT NULL
ORDER BY a.caseId
---
a = Cases (This is the main table)
b = Contacts (This is the table I am joining to using LEFT join)
Even though I do it like this and I give value = 0 when it is NULL I still
get no matches, and there is at least one results where there is one record
for 'cases' where cases.alienid is NULL, still won't show up.
What am I missing ?
Let me know if you need more info to help, thanks !
AleksOn Fri, 11 Feb 2005 16:00:50 -0500, Aleks wrote:

>I am doing a LEFT JOIN, that should display all files in table a even if
>there is no match with table B as far as I know.
>The problem is that if the field that joins A with B is NULL then I get no
>results, I am trying the following:
>--
>SELECT a.Id , a.CaseId , a.EmpId, a.AlienId, a.FirmAddressId, b.FirstNm ,
>b.MiddleNm, b.LastNm , b.FirmId, c.Processcatalog , a.MainCase ,
>d.MaidenNm
>FROM Cases a LEFT JOIN Users as d ON a.EmpId = d.UserId
>LEFT JOIN Users as b ON ISNULL (a.AlienId,'0') = b.UserId
>INNER JOIN Processcatalog as c ON Process = ProcesscatalogID WHERE
>ISNULL (a.CaseID,'') LIKE '%MMColParam%' AND ISNULL (b.LastNm,'') LIKE
>'MMColParam1%' AND ISNULL (b.FirstNm,'') LIKE 'MMColParam2%' AND
>b.Firmid = 'MMColParam3' AND a.archived LIKE 'MMColParam4' and
>a.firmaddressid LIKE 'MMColParam5' and ISNULL(a.firmaddressid,'')LIKE
>'MMColParam5' AND ISNULL(d.UserID,'') LIKE 'MMColParam6' AND MainCase IS
>NOT NULL
>ORDER BY a.caseId
>---
>a = Cases (This is the main table)
>b = Contacts (This is the table I am joining to using LEFT join)
>Even though I do it like this and I give value = 0 when it is NULL I still
>get no matches, and there is at least one results where there is one record
>for 'cases' where cases.alienid is NULL, still won't show up.
>What am I missing ?
Hi Aleks,
All filtering on the outer-join-ed tables should be move to the ON clause.
To explain: if a row from a (Cases) has no match in b (Users), then the
value of b.FirstNm will be NULL (becuase of the outer join). In the WHERE
clause, you have "... AND ISNULL (b.FirstNm,'') LIKE 'MMColParam2%'", so
these outer-joined rows will fail this test and be removed from the result
set.
You also don't need to use ISNULL here - NULL LIKE 'MMColParam2%' will not
evaluate to true anyway.
Finally, it's better to use = instead of LIKE when searching for one
specific value. Use LIKE only when searching for patterns.
SELECT a.Id, a.CaseId, a.EmpId, a.AlienId, a.FirmAddressId,
b.FirstNm, b.MiddleNm, b.LastNm, b.FirmId,
c.Processcatalog, a.MainCase, d.MaidenNm
FROM Cases AS a
LEFT JOIN Users AS d
ON d.UserId = a.EmpId
AND d.UserID = 'MMColParam6'
LEFT JOIN Users AS b
ON a.AlienId = b.UserId
AND b.LastNm LIKE 'MMColParam1%'
AND b.FirstNm LIKE 'MMColParam2%'
AND b.Firmid = 'MMColParam3'
INNER JOIN Processcatalog AS c
ON ?.Process = ?.ProcesscatalogID -- better qualify ALL columns
WHERE a.CaseID LIKE '%MMColParam%'
AND a.archived = 'MMColParam4'
AND a.firmaddressid = 'MMColParam5'
AND ?.MainCase IS NOT NULL -- better qualify ALL columns
ORDER BY a.caseId
(untested)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||I am using LIKE because people search for names using the first letters, not
all the name, that gives them flexibility, I use ISNULL because sometimes
they leave the last name of the first name blank, which is NULL in the
database, but I still need to return that record.
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:bg9q01dk2cr489b62eqtkbq7093gujnv9q@.
4ax.com...
> On Fri, 11 Feb 2005 16:00:50 -0500, Aleks wrote:
>
> Hi Aleks,
> All filtering on the outer-join-ed tables should be move to the ON clause.
> To explain: if a row from a (Cases) has no match in b (Users), then the
> value of b.FirstNm will be NULL (becuase of the outer join). In the WHERE
> clause, you have "... AND ISNULL (b.FirstNm,'') LIKE 'MMColParam2%'", so
> these outer-joined rows will fail this test and be removed from the result
> set.
> You also don't need to use ISNULL here - NULL LIKE 'MMColParam2%' will not
> evaluate to true anyway.
> Finally, it's better to use = instead of LIKE when searching for one
> specific value. Use LIKE only when searching for patterns.
> SELECT a.Id, a.CaseId, a.EmpId, a.AlienId, a.FirmAddressId,
> b.FirstNm, b.MiddleNm, b.LastNm, b.FirmId,
> c.Processcatalog, a.MainCase, d.MaidenNm
> FROM Cases AS a
> LEFT JOIN Users AS d
> ON d.UserId = a.EmpId
> AND d.UserID = 'MMColParam6'
> LEFT JOIN Users AS b
> ON a.AlienId = b.UserId
> AND b.LastNm LIKE 'MMColParam1%'
> AND b.FirstNm LIKE 'MMColParam2%'
> AND b.Firmid = 'MMColParam3'
> INNER JOIN Processcatalog AS c
> ON ?.Process = ?.ProcesscatalogID -- better qualify ALL columns
> WHERE a.CaseID LIKE '%MMColParam%'
> AND a.archived = 'MMColParam4'
> AND a.firmaddressid = 'MMColParam5'
> AND ?.MainCase IS NOT NULL -- better qualify ALL columns
> ORDER BY a.caseId
> (untested)
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||On Fri, 11 Feb 2005 16:51:19 -0500, Aleks wrote:

>I am using LIKE because people search for names using the first letters, no
t
>all the name, that gives them flexibility,
Hi Aleks,
Your code didn't allow for user input. It was just
somecol LIKE 'MMColParam2%' (where LIKE is fine) or
somecol LIKE 'MMColParam4' (where no wildcard is used, so LIKE has no
added value; use = to get better performance)

> I use ISNULL because sometimes
>they leave the last name of the first name blank, which is NULL in the
>database, but I still need to return that record.
But if you use ISNULL (a.AlienId,'0') = b.UserId, you'll only return the
row if b.UserID happens to be equal to '0', which is not too likely to
happen. And if you use ISNULL (b.FirstNm,'') LIKE 'MMColParam2%', you'll
only return the row when '' is LIKE 'MMColParam2%', which will definitely
never be the case, so the row won't be returned.
Q1: Did you try the query I suggested? Did it work?
Q2: Since I now have a feeling that your real problem is quite different
from the simplification you posted, could you now post something a little
bit closer to the real issue? If possible with SQL to construct your
tables and fill them with some sample data, and with a description of the
requested output from that sample data. See www.aspfaq.com/5006.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Saturday, February 25, 2012

Problem using Reporting Services forms authentication with SSL

I am using Reporting services 2005 and have enabled forms authentication using the example found in:
'C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Extension Samples\FormsAuthentication Sample'
This works correctly without SSL, but when I enable SSL I get an error when logging in. The symptoms are as follows. I can login to the reporting server (in my case <server>/ReportServer2) directory, but when I login to the report manager (in my case at <server>/Reports2) I get the following error:
'The underlying connection was closed: An unexpected error occurred on a send.'
Can anyone suggest why I might be getting this error?

Thank you,
Graham

Please check your RSWebApplication.config for the Entry ReportServerUrl. This should contain the correct reportserver url in this format

<UI>
<ReportServerUrl>https://<certificatename>/reportserver2</ReportServerUrl>
<ReportServerVirtualDirectory></ReportServerVirtualDirectory>