<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community - MS SQL</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our MS SQL forum is the place for Q&A-style discussions related to Microsoft SQL Server. Note we have an ASP.NET forum to use in tandem to MS SQL. Additionally, there is a Windows Servers and IIS forum within the Networking sub-forum of the Hardware and Software category.]]></description>
		<language>en-US</language>
		<lastBuildDate>Thu, 10 Dec 2009 05:24:02 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - MS SQL</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>SQL 2005 Unused Space</title>
			<link>http://www.daniweb.com/forums/thread244994.html</link>
			<pubDate>Wed, 09 Dec 2009 12:05:10 GMT</pubDate>
			<description>Hello, 
 
I have a 4 GB DB on SQL 2005 and the same on on sql 2008 that is growing 60MB per day, My concern is that should i allocate an unused space to the DB so that the DB wont create space for itself everyday (load on the server), what should be the size of the unused space for my DB</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have a 4 GB DB on SQL 2005 and the same on on sql 2008 that is growing 60MB per day, My concern is that should i allocate an unused space to the DB so that the DB wont create space for itself everyday (load on the server), what should be the size of the unused space for my DB</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>joewazen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread244994.html</guid>
		</item>
		<item>
			<title>dot used in column name</title>
			<link>http://www.daniweb.com/forums/thread244962.html</link>
			<pubDate>Wed, 09 Dec 2009 09:36:06 GMT</pubDate>
			<description><![CDATA[Hi  
I have a problem where dot is used in a table's column name. 
 
Say that there is a column called 101.name in a table t1. 
 
How do i reference this column in the following: 
 
select ... from table t1, table t2 where t1.101.name='test' 
 
This doesn't work because of the two dots in the same...]]></description>
			<content:encoded><![CDATA[<div>Hi <br />
I have a problem where dot is used in a table's column name.<br />
<br />
Say that there is a column called 101.name in a table t1.<br />
<br />
How do i reference this column in the following:<br />
<br />
select ... from table t1, table t2 where t1.101.name='test'<br />
<br />
This doesn't work because of the two dots in the same reference.<br />
<br />
Does anyone know how to do this?<br />
<br />
Thanks<br />
<br />
-------------<br />
Looks like it is t1.[101.name]='test' :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>fisk007</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread244962.html</guid>
		</item>
		<item>
			<title>No Payments over 90Days</title>
			<link>http://www.daniweb.com/forums/thread244837.html</link>
			<pubDate>Tue, 08 Dec 2009 23:40:57 GMT</pubDate>
			<description><![CDATA[Hi, A while back you guys helped me make a query that returns all clients that have not made a payment in 90 days. this works good. 
I now want to exclude those who have never made a payment. 
 
I tried to add in  
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi, A while back you guys helped me make a query that returns all clients that have not made a payment in 90 days. this works good.<br />
I now want to exclude those who have never made a payment.<br />
<br />
I tried to add in <br />
 <pre style="margin:20px; line-height:13px">Exists (Select Receipts.DateReceived from Receipts)</pre><br />
but no matter where I insert it I can't get it to work. I don't get any errors, but people that have never made a payment still show up. I run that in a query by itself and it works.<br />
here's my current query<br />
 <pre style="margin:20px; line-height:13px">SELECT&nbsp; &nbsp;  ClientID, WholeName,ClientStatus<br />
FROM&nbsp; &nbsp; &nbsp; &nbsp;  Clients WITH (NoLock)<br />
WHERE&nbsp; &nbsp;  (NOT EXISTS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (SELECT&nbsp; &nbsp;  *<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Receipts(NOLOCK)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE&nbsp; &nbsp; &nbsp; Clients.ClientID = Receipts.ClientID AND Receipts.DateReceived &gt;= getdate() - 90)) AND (ClientStatus LIKE 'active%' )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
GROUP BY ClientID, WholeName, ClientStatus<br />
Order By Clientid</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>_taz_</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread244837.html</guid>
		</item>
		<item>
			<title>Retrun a result of zero if no query results</title>
			<link>http://www.daniweb.com/forums/thread244821.html</link>
			<pubDate>Tue, 08 Dec 2009 21:39:31 GMT</pubDate>
			<description><![CDATA[I have the following query in MS Access 2007 
 
SELECT Projects.BIMinspector, Sum(Projects.R9) AS SumOfR9 
FROM Projects 
GROUP BY Projects.BIMinspector 
HAVING (((Projects.BIMinspector)=[forms]![Form Report]![Elist])); 
 
How do I get it to return a result of zero if no records are found?? 
 
Any...]]></description>
			<content:encoded><![CDATA[<div>I have the following query in MS Access 2007<br />
<br />
 <pre style="margin:20px; line-height:13px">SELECT Projects.BIMinspector, Sum(Projects.R9) AS SumOfR9<br />
FROM Projects<br />
GROUP BY Projects.BIMinspector<br />
HAVING (((Projects.BIMinspector)=&#91;forms&#93;!&#91;Form Report&#93;!&#91;Elist&#93;));</pre><br />
<br />
How do I get it to return a result of zero if no records are found??<br />
<br />
Any suggestions would be great.<br />
<br />
Thanks,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mela1006</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread244821.html</guid>
		</item>
		<item>
			<title>(rsErrorOpeningConnection) Could not obtain information about Windows NT.</title>
			<link>http://www.daniweb.com/forums/thread244606.html</link>
			<pubDate>Tue, 08 Dec 2009 05:58:30 GMT</pubDate>
			<description><![CDATA[I am trying to deploy a report to the Reporting Services Server but keep running up against this error: 
 
 
---Quote--- 
An error occurred during client rendering. 
An error has occurred during report processing. (rsProcessingAborted) 
Cannot create a connection to data source 'dataSource1'....]]></description>
			<content:encoded><![CDATA[<div>I am trying to deploy a report to the Reporting Services Server but keep running up against this error:<br />
<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  An error occurred during client rendering.<br />
An error has occurred during report processing. (rsProcessingAborted)<br />
Cannot create a connection to data source 'dataSource1'. (rsErrorOpeningConnection)<br />
Could not obtain information about Windows NT group/user 'DOMAIN\useradmin', error code 0x5.  <hr /> </td> </tr> </table> </div>Here’s my situation: Everything is being ran using DOMAIN\useradmin and the report is using a remote database.<br />
<br />
Reporting Services and SQL Server are both ran under DOMAIN\useradmin. DOMAIN\useradmin is a windows AD login and is part of the server machine Administrators group.<br />
<br />
My test report is using a data source model that in turn is using a data source that is connection to a database on a different SQL Server. The data source is using <span style="font-weight:bold">“Credentials stored securely in the report server”</span> with the options <span style="font-weight:bold">“Use as Windows credentials when connecting to the data source”</span> and <span style="font-weight:bold">“Impersonate the authenticated user after a connection has been made to the data source.”</span><br />
<br />
I am using the credentials of DOMAIN\useradmin that is the db owner of the remote database.<br />
<br />
DOMAIN\useradmin is assigned the roles, <span style="font-weight:bold">System Administrator, System User and Browser, Content Manager, My Reports, Publisher, Report Builder.</span><br />
<br />
So if everything is being run under an über AD account, why I am getting this Could not obtain information about Windows NT group/user 'DOMAIN\useradmin' error?<br />
<br />
Under normal circumstances , an AD login with Publisher permissions will developing reports using a datasource model created by DOMAIN\useradmin but using one of the remote database’s users which is mapped from yet another AD login.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>ChelleATL</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread244606.html</guid>
		</item>
		<item>
			<title>Database attaches as read-only, writes up permissions too</title>
			<link>http://www.daniweb.com/forums/thread243778.html</link>
			<pubDate>Fri, 04 Dec 2009 22:02:00 GMT</pubDate>
			<description><![CDATA[Hello, I've got some weird database issue, and I can't figure it out myself, so I'd like to ask for your help. 
My problem is the following: 
 
I've a working ASP.NET solution which relies on a MSSQL 2008 database, Express Edition. Now, I'm working on a WPF version of the same app, so I've copied...]]></description>
			<content:encoded><![CDATA[<div>Hello, I've got some weird database issue, and I can't figure it out myself, so I'd like to ask for your help.<br />
My problem is the following:<br />
<br />
I've a working ASP.NET solution which relies on a MSSQL 2008 database, Express Edition. Now, I'm working on a WPF version of the same app, so I've copied an instance of the database to my development machine, for testing my developing app in real-world circumstances.<br />
<br />
It had worked for a while, but recently, after copying the database again (like I did quite a lot of times), suddenly I wasn't able to modify the database, and got the error message, when I tried to modify it, running the app from Visual Studio: <br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  Failed to update database &quot;C:\SQL\PARADATA.MDF&quot; because the database is read-only.  <hr /> </td> </tr> </table> </div>I'm attaching it form my app. First, I checked the access rights, and granted full rights to everybody (just to make sure it works). Now, when I attached again, got the same error message, went back to the access rights, and noticed that my recently added rights were gone. I run another circle, and the same thing happened.<br />
<br />
I'm not able to modify it from SSMS also, first it shows up as a read-only database (grayed out), then, when I set it to writable, update it, and nothing happens, but I don't receive any error message in this case.<br />
<br />
So, if anyone would be able to help, I'd really appreciate it. But the key issue here is (as I think) what happened between two usual database copy-paste which had caused this.. <br />
Any suggestions?<br />
<br />
Thanks in advance!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>konczuras</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread243778.html</guid>
		</item>
		<item>
			<title>how to updete field for a set of records  from one record in the same table?</title>
			<link>http://www.daniweb.com/forums/thread243672.html</link>
			<pubDate>Fri, 04 Dec 2009 13:16:24 GMT</pubDate>
			<description><![CDATA[I would like to update 2 fields values from one record to a set of records in the same table: 
 
I tryed this: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>I would like to update 2 fields values from one record to a set of records in the same table:<br />
<br />
I tryed this:<br />
 <pre style="margin:20px; line-height:13px">UPDATE dd SET dd.comment = y.comment, dd.author = y. author<br />
FROM Table1 dd LEFT OUTER JOIN<br />
(SELECT * FROM Table1 WHERE Idx=1234) y<br />
ON dd.vin = y.vin<br />
WHERE dd.vin like '%WLS%'</pre><br />
vin and idx fields are unique keys<br />
My desire is to have the fields comment and author updated from the record which has idx=1234 to all the records whic contain in field vin 'WLS' string.<br />
thanks in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Teofil</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread243672.html</guid>
		</item>
		<item>
			<title>Adding an Identity Later T-SQL</title>
			<link>http://www.daniweb.com/forums/thread243607.html</link>
			<pubDate>Fri, 04 Dec 2009 08:20:23 GMT</pubDate>
			<description><![CDATA[Good Day All 
 
i have a Table with the ID Field that was not an identity Field. This Field has not Duplicates. Now later i want to Change this numeric Field as an Identity Field like this 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Good Day All<br />
<br />
i have a Table with the ID Field that was not an identity Field. This Field has not Duplicates. Now later i want to Change this numeric Field as an Identity Field like this<br />
<br />
 <pre style="margin:20px; line-height:13px">--STEP 7 ADD THE IDENTITY BACK IN TABLE MTM_ACTV_STAFF<br />
ALTER TABLE [New_Jaco].[dbo].[MTM_ACTV_STAFF]<br />
ALTER COLUMN [ID] IDENTITY(1,1)</pre><br />
but i get an Error that says<br />
<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  Msg 156, Level 15, State 1, Line 3<br />
Incorrect syntax near the keyword 'IDENTITY'.  <hr /> </td> </tr> </table> </div></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread243607.html</guid>
		</item>
		<item>
			<title>database suggestions</title>
			<link>http://www.daniweb.com/forums/thread243381.html</link>
			<pubDate>Thu, 03 Dec 2009 14:59:57 GMT</pubDate>
			<description><![CDATA[last semester, i did an airline reservation system. we need to create another system for this semester. any suggestions? [except inventory and enrollment systems] 
 
thanks]]></description>
			<content:encoded><![CDATA[<div>last semester, i did an airline reservation system. we need to create another system for this semester. any suggestions? [except inventory and enrollment systems]<br />
<br />
thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>scias23</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread243381.html</guid>
		</item>
		<item>
			<title>SQL Function</title>
			<link>http://www.daniweb.com/forums/thread243098.html</link>
			<pubDate>Wed, 02 Dec 2009 17:34:43 GMT</pubDate>
			<description><![CDATA[I use SQL  Server 2005 and I create function.Below I mention the Function that I created. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code...]]></description>
			<content:encoded><![CDATA[<div>I use SQL  Server 2005 and I create function.Below I mention the Function that I created.<br />
 <pre style="margin:20px; line-height:13px">CREATE FUNCTION dbo.udf_GetCountryID(@Name varchar(50))<br />
RETURNS VARCHAR(1000) AS<br />
<br />
BEGIN<br />
Declare @Description varchar(4000)<br />
select @Description = coalesce(@Description + ',' , '' ) +&nbsp; countryCode <br />
FROM dbo.Test_Table where CommonName='Japan'<br />
<br />
Return @Description<br />
END</pre><br />
After creating function I use below SQL statement<br />
<br />
 <pre style="margin:20px; line-height:13px">select dbo.udf_GetCountryID(Distinct(F.CommonName))CountryName from dbo.Test_Table F</pre><br />
but I got the Error message.Below I mention the error message also<br />
<span style="color:Red">Msg 208, Level 16, State 101, Line 1<br />
Invalid object name 'dbo.udf_GetCountryID'.<br />
</span><br />
<br />
Once I create the function its comes under scalar-valued function.I am using sql server 2005.Please help me<br />
<br />
Thanks <br />
Tank50</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Tank50</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread243098.html</guid>
		</item>
		<item>
			<title>searching problem in SQL server 2005</title>
			<link>http://www.daniweb.com/forums/thread243011.html</link>
			<pubDate>Wed, 02 Dec 2009 11:57:59 GMT</pubDate>
			<description>hai all 
 
i am facing some problem in SQL.I am searching the one string(ex.roll-over) in table 
its returning wrong results. 
my table contains, 
 
dable datas 
table_1 is table name 
number1 text1 
1 notify us the day you roll check over.</description>
			<content:encoded><![CDATA[<div>hai all<br />
<br />
i am facing some problem in SQL.I am searching the one string(ex.roll-over) in table<br />
its returning wrong results.<br />
my table contains,<br />
<br />
dable datas<br />
table_1 is table name<br />
number1 text1<br />
1 notify us the day you roll check over.<br />
2 notify us theday you roll check .<br />
3 notify us the day you roll check roll-over.<br />
4 notify us the day you roll check roll over.<br />
<br />
<br />
my query is<br />
select * from table_1 WHERE CONTAINS(text1, '&quot;roll-over&quot;')<br />
select * from table_1 WHERE CONTAINS(text1, 'roll-over')<br />
<br />
in both case i am getting below results.<br />
results<br />
number1 text1<br />
1 notify us the day you roll check over.<br />
2 notify us theday you roll check .<br />
3 notify us the day you roll check roll-over.<br />
4 notify us the day you roll check roll over.<br />
<br />
here it should return only one result insted of four.<br />
is there any thing wrong in Query if not can any one help to from the correct query.<br />
i think Bcoz os hyphen the result is returinig either roll or over presents.<br />
<br />
<br />
thanks <br />
mahe</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mm4215</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread243011.html</guid>
		</item>
		<item>
			<title>Change from a Mysql database</title>
			<link>http://www.daniweb.com/forums/thread242787.html</link>
			<pubDate>Tue, 01 Dec 2009 15:12:42 GMT</pubDate>
			<description><![CDATA[Hello,  
 
We are currently using a Mysql database: we would like to change. Now, we'd like to use Mssql. Only problem is that most of the data and other information are on Mysql. Can you help us with this? 
 
Thanks a lot for your help.]]></description>
			<content:encoded><![CDATA[<div>Hello, <br />
<br />
We are currently using a Mysql database: we would like to change. Now, we'd like to use Mssql. Only problem is that most of the data and other information are on Mysql. Can you help us with this?<br />
<br />
Thanks a lot for your help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>asmikwen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242787.html</guid>
		</item>
		<item>
			<title>Search for numeric values from a varchar field in SQL server</title>
			<link>http://www.daniweb.com/forums/thread242779.html</link>
			<pubDate>Tue, 01 Dec 2009 14:21:22 GMT</pubDate>
			<description><![CDATA[Hi 
 
I have a column named 'ExtRefNo' which of varchar datatype. 
The values can be numbers alone(eg; 101) & values comprising characters & numbers(eg:101A3) 
 
My requirement is if the user search for ExtRefNo between 100 & 105, 
it shud retrieve all ExtRefNos ranging from 100,101,102,103,104 &...]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
<br />
I have a column named 'ExtRefNo' which of varchar datatype.<br />
The values can be numbers alone(eg; 101) &amp; values comprising characters &amp; numbers(eg:101A3)<br />
<br />
My requirement is if the user search for ExtRefNo between 100 &amp; 105,<br />
it shud retrieve all ExtRefNos ranging from 100,101,102,103,104 &amp; 105.<br />
Need not include the ExtRefNo, if it is 101A3.<br />
<br />
I used Isnumeric() in a Case statement <br />
Something like this..don't know the correct syntax<br />
<br />
Case When Isnumeric(@FromContractExtRef2) = 1 and Isnumeric(@ToContractExtRef2) = 1<br />
			 Then Cast(Contract.ExternalRef2 as int) <br />
			 Else @FromContractExtRef2 End <br />
Between ......<br />
<br />
The Problem is that if the user search for ExtRefNo 101A3...it should only find the record that has got this ExtRefNo 101A3 , ie if the search values entered for @FromContractExtRef2 and @ToContractExtRef2 is numeric..then it should find all the ExtRefNo between that range..else should find the ExtRefNo which is like @FromContractExtRef2.<br />
<br />
Hope this makes sense.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>renu_kj</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread242779.html</guid>
		</item>
		<item>
			<title>Hospital administration database</title>
			<link>http://www.daniweb.com/forums/thread241790.html</link>
			<pubDate>Fri, 27 Nov 2009 12:42:32 GMT</pubDate>
			<description><![CDATA[DRIEND FRIENDS, 
I am given a project "hospital administration database" 
Could you please guide me how to start and proceed. 
Thanks and Regards. 
Shariq]]></description>
			<content:encoded><![CDATA[<div>DRIEND FRIENDS,<br />
I am given a project &quot;hospital administration database&quot;<br />
Could you please guide me how to start and proceed.<br />
Thanks and Regards.<br />
Shariq</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>shariqmsit</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241790.html</guid>
		</item>
		<item>
			<title>Count on chars to match on another column</title>
			<link>http://www.daniweb.com/forums/thread241692.html</link>
			<pubDate>Fri, 27 Nov 2009 00:50:54 GMT</pubDate>
			<description><![CDATA[Hi Guys 
 
It may be friday, but I am having a real brain fade with this one. 
I have one table which contains several columns (see below) I need to match names in the tables. The first name is in column childname1 which contains the full name, the column I need to match to is in "firstname" and...]]></description>
			<content:encoded><![CDATA[<div>Hi Guys<br />
<br />
It may be friday, but I am having a real brain fade with this one.<br />
I have one table which contains several columns (see below) I need to match names in the tables. The first name is in column childname1 which contains the full name, the column I need to match to is in &quot;firstname&quot; and &quot;familyname&quot; columns respectively.<br />
<br />
I need a display the groupid beside the matching childname1 column. Now I can think of concatenating the first and family name columns to make it easier I can also think of doing it in excel, but I am looking for a count match on the first 3 letters of the firstname to the childname1 first name.<br />
any ideas, have looked at pathindex and charindex to work it.!<br />
groupid<br />
093911982| NULL| Margaret| Johnston| Miss Grace Johnston|<br />
037281982| NULL| Louise|Kelly|Ms Brianna Kelly|<br />
083753534|NULL|Grace|Johnstone|NULL|<br />
<br />
cheers</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>iann</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241692.html</guid>
		</item>
		<item>
			<title><![CDATA[my clock to end postings does'nt work]]></title>
			<link>http://www.daniweb.com/forums/thread241544.html</link>
			<pubDate>Thu, 26 Nov 2009 10:35:37 GMT</pubDate>
			<description><![CDATA[Use this code 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div> <strong>MS SQL...]]></description>
			<content:encoded><![CDATA[<div>Use this code<br />
 <pre style="margin:20px; line-height:13px">&nbsp;  sql = &quot;SELECT products.endDate FROM products INNER JOIN &quot;<br />
&nbsp;  sql = sql &amp; &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; auctionevents ON products.idsupplier = auctionevents.idSupplier &quot;<br />
&nbsp;  sql = sql &amp; &quot;&nbsp; &nbsp; &nbsp; &nbsp; WHERE&nbsp; &nbsp;  (products.endDate &gt; CURRENT_TIMESTAMP) AND (auctionevents.ID = &quot;&amp;id&amp;&quot;)&nbsp; AND (products.ListHidden &lt;&gt; 1)&quot;</pre><br />
but if the server is not run the endDate goes past currenttimestamp and continues forward, anyone help please?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>gsc1ugs</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241544.html</guid>
		</item>
		<item>
			<title>there is already an object named #instmsdb</title>
			<link>http://www.daniweb.com/forums/thread241428.html</link>
			<pubDate>Thu, 26 Nov 2009 02:47:50 GMT</pubDate>
			<description>Hi Gurus, 
 
I am attempting to install KB970892 on SQL Express 2005SP3, 
and I am unable to do so, due to a SQL suspended installation. 
 
When I try to continue the installation (which I have no idea what is it trying to install - I have inherited this server the way it is), the following errors...</description>
			<content:encoded><![CDATA[<div>Hi Gurus,<br />
<br />
I am attempting to install KB970892 on SQL Express 2005SP3,<br />
and I am unable to do so, due to a SQL suspended installation.<br />
<br />
When I try to continue the installation (which I have no idea what is it trying to install - I have inherited this server the way it is), the following errors occur:<br />
<br />
&quot;there is already an object named 'sysmail_update_profileaccount_sp' in the database&quot;<br />
<br />
followed by<br />
<br />
&quot;there is already an object named #InstMsdb in the database&quot;<br />
<br />
and the installation is unable to continue from this point.<br />
<br />
I have tried searching the web and forums but no answer ..<br />
<br />
Any leads will be greatly appreciated!<br />
<br />
Thank you,<br />
<br />
-Ishay</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>ishaybas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241428.html</guid>
		</item>
		<item>
			<title>increase maximum number of result sets</title>
			<link>http://www.daniweb.com/forums/thread241279.html</link>
			<pubDate>Wed, 25 Nov 2009 12:56:38 GMT</pubDate>
			<description>I get the following message when executing a stored procedure. 
 
The query has exceeded the maximum number of result sets that can be displayed in the results grid. Only the first 100 result sets are displayed in the grid. 
 
However , i cannot change the fact that the SP uses a cursor. 
...</description>
			<content:encoded><![CDATA[<div>I get the following message when executing a stored procedure.<br />
<br />
<span style="color:Red">The query has exceeded the maximum number of result sets that can be displayed in the results grid. Only the first 100 result sets are displayed in the grid.</span><br />
<br />
However , i cannot change the fact that the SP uses a cursor.<br />
<br />
Basically what happens is that the SP executes into a declared table, and then for each row it executes a new stored procedure bringing the number of result sets to about 20 000....<br />
<br />
Any advice on where i can change this setting  ?<br />
<br />
Regards,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>cVz</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241279.html</guid>
		</item>
		<item>
			<title>Scheduling Jobs in SQL Server 2005</title>
			<link>http://www.daniweb.com/forums/thread241247.html</link>
			<pubDate>Wed, 25 Nov 2009 10:13:39 GMT</pubDate>
			<description>PRACTICA EXAMPLE FOR Scheduling Jobs in SQL Server 2005</description>
			<content:encoded><![CDATA[<div>PRACTICA EXAMPLE FOR Scheduling Jobs in SQL Server 2005</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>farhan111</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241247.html</guid>
		</item>
		<item>
			<title>Multiple joins on the same table</title>
			<link>http://www.daniweb.com/forums/thread241241.html</link>
			<pubDate>Wed, 25 Nov 2009 09:48:49 GMT</pubDate>
			<description>Hi. 
 
I have a question to advanced SQL programmers/users. I would be very grateful if you could explain me in simple words why we use multiple joins on the same table (for example multiple left outer joins) - what benefits it brings?  
 
examples would be appreciated 
 
best regards 
q</description>
			<content:encoded><![CDATA[<div>Hi.<br />
<br />
I have a question to advanced SQL programmers/users. I would be very grateful if you could explain me in simple words why we use multiple joins on the same table (for example multiple left outer joins) - what benefits it brings? <br />
<br />
examples would be appreciated<br />
<br />
best regards<br />
q</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>questionary</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241241.html</guid>
		</item>
		<item>
			<title>query to get highest bid from data</title>
			<link>http://www.daniweb.com/forums/thread240948.html</link>
			<pubDate>Tue, 24 Nov 2009 10:25:43 GMT</pubDate>
			<description><![CDATA[Hi 
 
I have this data 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
<br />
I have this data<br />
<br />
 <pre style="margin:20px; line-height:13px">CustBid&nbsp; &nbsp; &nbsp; &nbsp; idProduct&nbsp; &nbsp; &nbsp; &nbsp; bidAmount&nbsp; &nbsp; &nbsp; &nbsp; bidDate<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 165.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-20 09:05:31.640<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 155.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-20 09:05:25.480<br />
4&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 95.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-19 12:40:44.973<br />
4&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 85.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-19 12:40:40.377<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 85.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-12 11:20:52.400<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 85.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-12 11:20:52.400<br />
4&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 75.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-12 11:11:02.080<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 65.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-12 11:20:20.170<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 45.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-12 11:08:02.407<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 272&nbsp; &nbsp; &nbsp; &nbsp; 25.00&nbsp; &nbsp; &nbsp; &nbsp; 2009-11-12 11:05:06.663</pre><br />
and I want to be able to list the second highest bid that is not the same user so what i would like to display is 95 because bidder 1 has two higher so i dont want those proxy bids visible, what query could i use? have this so far<br />
<br />
 <pre style="margin:20px; line-height:13px">Select bidhistory.idCustomerBid as CustBid, bidhistory.idProduct, bidhistory.bidAmount, bidhistory.bidDate From bidhistory where (bidhistory.idProduct = 272) AND (idCustomerBid &lt;&gt; 2) order by bidAmount desc</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>gsc1ugs</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240948.html</guid>
		</item>
		<item>
			<title>How to use unused space / white space in SQL server 2000</title>
			<link>http://www.daniweb.com/forums/thread240886.html</link>
			<pubDate>Tue, 24 Nov 2009 04:24:18 GMT</pubDate>
			<description><![CDATA[Hi,,, we have a database grown too fast... from 19GB last march 09 into 52GB this Nov 09... I search through internet on what happen why do database grow fast and i find nothing,, i found out on how to "sp_spaceused" query and the result says: 
 
database_name        database_size          ...]]></description>
			<content:encoded><![CDATA[<div>Hi,,, we have a database grown too fast... from 19GB last march 09 into 52GB this Nov 09... I search through internet on what happen why do database grow fast and i find nothing,, i found out on how to &quot;sp_spaceused&quot; query and the result says:<br />
<br />
database_name        database_size           unallocated space<br />
MPSDB                       52808.63 MB              4248.71 MB<br />
<br />
reserved          data              index_size        unused<br />
49589288 KB   6859920 KB  2001880 KB      40727488 KB<br />
<br />
My question is: is there's a way on how to use the unused bytes/allocation or can we remove those whitespaces to gain more space in our HD drive?<br />
<br />
Help pls... i'm begging you all geniuses to pls help me.. tnx</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>xirosen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240886.html</guid>
		</item>
		<item>
			<title>Help with an Inventory Update trigger</title>
			<link>http://www.daniweb.com/forums/thread240845.html</link>
			<pubDate>Tue, 24 Nov 2009 01:07:54 GMT</pubDate>
			<description><![CDATA[I'm currently studying SQL and have created two tables (Orders and Inventory).   I have been trying to create a trigger on the "OrderDate" column of the Orders table to update the Cur_Stock value (to subtract the Quantity ordered from the Cur_Stock) on the Inventory table whenever a new Order is...]]></description>
			<content:encoded><![CDATA[<div>I'm currently studying SQL and have created two tables (Orders and Inventory).   I have been trying to create a trigger on the &quot;OrderDate&quot; column of the Orders table to update the Cur_Stock value (to subtract the Quantity ordered from the Cur_Stock) on the Inventory table whenever a new Order is placed.   I've tried searching the internet but haven't had any success and I need some help with it.<br />
<br />
HERE IS MY CODE:<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">CREATE TRIGGER &#91;UpdateInventory&#93;<br />
ON &#91;dbo&#93;.&#91;Orders&#93;<br />
&nbsp;  FOR INSERT<br />
AS<br />
DECLARE @OrderDate smalldatetime<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Quantity INT<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
SELECT @OrderDate = OrderDate, @Quantity=Quantity FROM Orders<br />
<br />
BEGIN<br />
UPDATE Inventory<br />
SET Cur_Stock = Cur_Stock - @Quantity<br />
WHERE @OrderDate = GetDate()<br />
END</pre><br />
<br />
But obviously it isn't working.  Can someone help me understand what I'm missing and WHY the above isn't working?<br />
<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>TJGreene</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240845.html</guid>
		</item>
		<item>
			<title>Pivot Table with dynamic Columns</title>
			<link>http://www.daniweb.com/forums/thread240804.html</link>
			<pubDate>Mon, 23 Nov 2009 21:53:54 GMT</pubDate>
			<description><![CDATA[I am trying to write a query in my .net app and I'm having trouble pivoting the table since the columns are generated dynamically (based on a month range selected by the user) 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I am trying to write a query in my .net app and I'm having trouble pivoting the table since the columns are generated dynamically (based on a month range selected by the user)<br />
<br />
 <pre style="margin:20px; line-height:13px">SELECT SUM(HEALTH_MTTR) AS MTTR, SUM(HEALTH_OTR) AS OTR, SUM(HEALTH_REPEAT) AS REPEAT, SUM(HEALTH_CHRONIC) AS CHRONIC, SUM(HEALTH_TOTAL) AS TOTAL, (CAST(CAST(YEAR([DATE_RESOLVED_FOR_CLOSURE]) AS VARCHAR(4)) + '-' + Right('00' + CAST(MONTH([DATE_RESOLVED_FOR_CLOSURE]) AS VARCHAR(2)), 2) AS VARCHAR(7))) As YearMonth<br />
FROM TRT_remedy_tickets <br />
WHERE COMPID = @COMPID AND (CAST(CAST(YEAR([DATE_RESOLVED_FOR_CLOSURE]) AS VARCHAR(4)) + '-' + Right('00' + CAST(MONTH([DATE_RESOLVED_FOR_CLOSURE]) AS VARCHAR(2)), 2) AS VARCHAR(7))) BETWEEN @START AND @END<br />
Group By (CAST(CAST(YEAR([DATE_RESOLVED_FOR_CLOSURE]) AS VARCHAR(4)) + '-' + Right('00' + CAST(MONTH([DATE_RESOLVED_FOR_CLOSURE]) AS VARCHAR(2)), 2) AS VARCHAR(7)))</pre><br />
Generates a table like so:<br />
MTTR     OTR     REPEAT     CHRONIC     TOTAL     YearMonth<br />
x             x             x               x                x               2009-06<br />
x             x             x               x                x               2009-07<br />
x             x             x               x                x               2009-08<br />
<br />
And I need the table to be displayed like so<br />
TYPE     2009-06     2009-07     2009-08     2009-09<br />
MTTR        x                 x                x                    x <br />
OTR          x                 x               x                     x <br />
REP          x                 x                x                    x<br />
CHR          x                 x               x                     x<br />
TOT          x                  x              x                      x</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>kardsen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240804.html</guid>
		</item>
		<item>
			<title>HeLp plZ Save a daily query result as Csv Into  New File</title>
			<link>http://www.daniweb.com/forums/thread240723.html</link>
			<pubDate>Mon, 23 Nov 2009 14:47:04 GMT</pubDate>
			<description>Hi all, 
 
i use mssql 2005 
 
I have a doubt, how to create a schedule for a query to run every day,the result should be saved every time the query runs, into a new file 
 
For the moment I use SQL Server Agent to do this daily,  
with a jobtask and my query inserted. The output has no extension...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
i use mssql 2005<br />
<br />
I have a doubt, how to create a schedule for a query to run every day,the result should be saved every time the query runs, into a new file<br />
<br />
For the moment I use SQL Server Agent to do this daily, <br />
with a jobtask and my query inserted. The output has no extension<br />
he doesn’t seem to make a new file every time, just replaces it.<br />
<br />
Also the outputtfile should be automatically saved/exported as an Csv file.If thats possible...<br />
These are my first steps with mssql server. <br />
Im loving it, but now Im stuck since a few days.<br />
<br />
Greetz Kristof</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Likethatjazz</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240723.html</guid>
		</item>
		<item>
			<title>Help with a Following Query</title>
			<link>http://www.daniweb.com/forums/thread240661.html</link>
			<pubDate>Mon, 23 Nov 2009 10:30:01 GMT</pubDate>
			<description><![CDATA[Good Day All  
 
i have the Following that table  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code...]]></description>
			<content:encoded><![CDATA[<div>Good Day All <br />
<br />
i have the Following that table <br />
<br />
 <pre style="margin:20px; line-height:13px">ID&nbsp; | ACTV |VENU |STUD | TRIES<br />
=====================================<br />
1&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp;  4&nbsp; &nbsp; &nbsp; &nbsp;  162&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
2&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp;  5&nbsp; &nbsp; &nbsp; &nbsp;  104&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
3&nbsp; &nbsp; &nbsp; &nbsp; 8&nbsp;  5&nbsp; &nbsp; &nbsp; &nbsp;  138&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
4&nbsp; &nbsp; &nbsp; &nbsp; 15&nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp;  68&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
5&nbsp; &nbsp; &nbsp; &nbsp; 15&nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp;  291&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
6&nbsp; &nbsp; &nbsp; &nbsp; 21&nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp;  171&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
7&nbsp; &nbsp; &nbsp; &nbsp; 22&nbsp; 5&nbsp; &nbsp; &nbsp; &nbsp;  101&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
8&nbsp; &nbsp; &nbsp; &nbsp; 27&nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp;  11&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
9&nbsp; &nbsp; &nbsp; &nbsp; 28&nbsp; 5&nbsp; &nbsp; &nbsp; &nbsp;  6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
10&nbsp; &nbsp; &nbsp; &nbsp; 31&nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp;  8&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
11&nbsp; &nbsp; &nbsp; &nbsp; 32&nbsp; 6&nbsp; &nbsp; &nbsp; &nbsp;  6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0 <br />
12&nbsp; &nbsp; &nbsp; &nbsp; 33&nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp;  308&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0<br />
13&nbsp; &nbsp; &nbsp; &nbsp; 35&nbsp; 6&nbsp; &nbsp; &nbsp; &nbsp;  68&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0</pre><br />
now i have the Following Query that Tries to find the ID's of the records that appear twice in the  &quot;VENU&quot; Field. <br />
<br />
 <pre style="margin:20px; line-height:13px">SELECT id <br />
FROM [dbo].SOL_ACTV_VENU<br />
group by&nbsp; id <br />
having count(venu) &gt; 1<br />
order by sum(stud)</pre><br />
and it seems that it give me nothing while in the table i see there are records like that<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240661.html</guid>
		</item>
		<item>
			<title>Any idea on what happen to our database.</title>
			<link>http://www.daniweb.com/forums/thread240605.html</link>
			<pubDate>Mon, 23 Nov 2009 05:18:14 GMT</pubDate>
			<description><![CDATA[Hi,, i am a newbie in SQL server.. we have a database in our office.. I notice that since 2004 - 2008 our database growth was about 19GB, but since jan. 2009 to present our database grows from 19GB to 52GB... is there's something wrong happening in our database's configuration?  
 
Can anyone pls...]]></description>
			<content:encoded><![CDATA[<div>Hi,, i am a newbie in SQL server.. we have a database in our office.. I notice that since 2004 - 2008 our database growth was about 19GB, but since jan. 2009 to present our database grows from 19GB to 52GB... is there's something wrong happening in our database's configuration? <br />
<br />
Can anyone pls share an idea..<br />
<br />
Thanks..<br />
<br />
Sorry for my english..</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>xirosen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240605.html</guid>
		</item>
		<item>
			<title>Inserting into temporary table by dynamic query</title>
			<link>http://www.daniweb.com/forums/thread239985.html</link>
			<pubDate>Fri, 20 Nov 2009 10:40:52 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I have created a temporary @table and while inserting ,i am using dynamic sql.But this is not getting executed and throws an error that  
"EXECUTE cannot be used as a source when inserting into a table variable" 
i am using SQLServer2005. 
Dont know where i am going wrong 
  <div...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I have created a temporary @table and while inserting ,i am using dynamic sql.But this is not getting executed and throws an error that <br />
&quot;EXECUTE cannot be used as a source when inserting into a table variable&quot;<br />
i am using SQLServer2005.<br />
Dont know where i am going wrong<br />
 <pre style="margin:20px; line-height:13px">DECLARE @SqlQuery NVARCHAR(4000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; SELECT @SqlQuery='SELECT TOP '+CAST(@no_of_rows as CHAR)+'tblEmployee.id&nbsp;  ,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tblProject.ID, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; FROM&nbsp; &nbsp; &nbsp; &nbsp;  tblBilling (NOLOCK) '<br />
INSERT @table <br />
EXEC @SqlQuery</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>carobee</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239985.html</guid>
		</item>
		<item>
			<title>count non empty xml nodes</title>
			<link>http://www.daniweb.com/forums/thread239572.html</link>
			<pubDate>Wed, 18 Nov 2009 21:54:11 GMT</pubDate>
			<description><![CDATA[If i have some xml in the form 
<root> 
<a>hello</a> 
<b> 
     <bi>hiya</bi> 
     <bii>hey</bii> 
</b> 
<c/> 
<d>hello again</d> 
</root>]]></description>
			<content:encoded><![CDATA[<div>If i have some xml in the form<br />
 <pre style="margin:20px; line-height:13px">&lt;root&gt;<br />
&lt;a&gt;hello&lt;/a&gt;<br />
&lt;b&gt;<br />
&nbsp; &nbsp;  &lt;bi&gt;hiya&lt;/bi&gt;<br />
&nbsp; &nbsp;  &lt;bii&gt;hey&lt;/bii&gt;<br />
&lt;/b&gt;<br />
&lt;c/&gt;<br />
&lt;d&gt;hello again&lt;/d&gt;<br />
&lt;/root&gt;</pre><br />
how can I <br />
<br />
a) count the nodes? i.e. a, b, bi, bii, c, d so 6<br />
b) count the nodes that are non empty a, bi, bii, d so 4<br />
<br />
?<br />
<br />
i have tried <br />
<br />
xmldata.query('count(/root/*)')    ))<br />
<br />
but that only counts the top level nodes and I have no idea where to start with the non empty nodes<br />
<br />
any help will be very much appreciated</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>londonstan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239572.html</guid>
		</item>
		<item>
			<title>Migrate data from Mysql to Mssql</title>
			<link>http://www.daniweb.com/forums/thread239495.html</link>
			<pubDate>Wed, 18 Nov 2009 16:23:46 GMT</pubDate>
			<description>Hi, 
 
I am trying to transfer some data from a Mysql database onto a Microsoft SQL database. I would need your help on how to operate this migration as I am new to MSSQL. I have been looking on Google but there are not a lot of pages on that. Can someone help me? 
 
Thanks.</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am trying to transfer some data from a Mysql database onto a Microsoft SQL database. I would need your help on how to operate this migration as I am new to MSSQL. I have been looking on Google but there are not a lot of pages on that. Can someone help me?<br />
<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>asmikwen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239495.html</guid>
		</item>
		<item>
			<title>Parent and Child nodes from a table (navigation category table)</title>
			<link>http://www.daniweb.com/forums/thread239171.html</link>
			<pubDate>Tue, 17 Nov 2009 10:26:24 GMT</pubDate>
			<description>Hi all, 
 
I have a single table with both parent and child nodes, and each has an order number in it. 
 
I am trying to write a single query to output them in order, its for a navigation list with categories and sub-categories. 
 
I could manage it in code rather than in the SQL query but it would...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
I have a single table with both parent and child nodes, and each has an order number in it.<br />
<br />
I am trying to write a single query to output them in order, its for a navigation list with categories and sub-categories.<br />
<br />
I could manage it in code rather than in the SQL query but it would involve calling a query from within a query loop - which I want to avoid.<br />
<br />
Table:<br />
<br />
 <pre style="margin:20px; line-height:13px">DBID | Title | ParentID | OrderNum<br />
&nbsp;1&nbsp; &nbsp; &nbsp; aaa&nbsp; &nbsp; &nbsp;  0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1<br />
&nbsp;2&nbsp; &nbsp; &nbsp; bbb&nbsp; &nbsp; &nbsp;  0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2<br />
&nbsp;3&nbsp; &nbsp; &nbsp; ccc&nbsp; &nbsp; &nbsp;  1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1<br />
&nbsp;4&nbsp; &nbsp; &nbsp; ddd&nbsp; &nbsp; &nbsp;  1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2<br />
&nbsp;5&nbsp; &nbsp; &nbsp; eee&nbsp; &nbsp; &nbsp;  2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1</pre><br />
and I want to get a result set like:<br />
 <pre style="margin:20px; line-height:13px">DBID | Title | ParentID | OrderNum<br />
&nbsp;1&nbsp; &nbsp; &nbsp; aaa&nbsp; &nbsp; &nbsp;  0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &lt;&lt;&lt; main <br />
&nbsp;3&nbsp; &nbsp; &nbsp; ccc&nbsp; &nbsp; &nbsp;  1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &lt;&lt;&lt; child<br />
&nbsp;4&nbsp; &nbsp; &nbsp; ddd&nbsp; &nbsp; &nbsp;  1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &lt;&lt;&lt; 2nd child<br />
&nbsp;2&nbsp; &nbsp; &nbsp; bbb&nbsp; &nbsp; &nbsp;  0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &lt;&lt;&lt; main <br />
&nbsp;5&nbsp; &nbsp; &nbsp; eee&nbsp; &nbsp; &nbsp;  2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &lt;&lt;&lt; child</pre><br />
I have been looking at using a recursive SQL select or Common Table Expressions (CTE) but have not been able to figure it out yet.<br />
<br />
Can anyone help point me in the right direction?<br />
<br />
(Using SQL Server 2005 / ASP.Net C#)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>shibbard</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239171.html</guid>
		</item>
		<item>
			<title>My Insert statement needs a trim</title>
			<link>http://www.daniweb.com/forums/thread238879.html</link>
			<pubDate>Mon, 16 Nov 2009 09:57:51 GMT</pubDate>
			<description>Hi, 
 
I have an insert statement that i need to refine...basically I need to trim the first couple of letters of whats trapped inthe field. 
so e.g.  
 
Z:\aaa\1.jpg  
 
needs to become  
 
aaa\1.jpg</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I have an insert statement that i need to refine...basically I need to trim the first couple of letters of whats trapped inthe field.<br />
so e.g. <br />
<br />
Z:\aaa\1.jpg <br />
<br />
needs to become <br />
<br />
aaa\1.jpg<br />
<br />
Im tried this but its not working<br />
<br />
 <pre style="margin:20px; line-height:13px">sImagelink = mid(request.form(&quot;Imagelink&quot;),4,len(request.form(&quot;Imagelink&quot;)))</pre><br />
any ideas?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>kegathor</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238879.html</guid>
		</item>
		<item>
			<title>SQL SUM Decimals</title>
			<link>http://www.daniweb.com/forums/thread238498.html</link>
			<pubDate>Sat, 14 Nov 2009 14:48:20 GMT</pubDate>
			<description><![CDATA[Hi all... 
So, I am needing to sum all billable hours within a table... the problem is that it is returning rouded decimals instead... like .5 always comes back as 1 ...  
 
Here is my procedure: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi all...<br />
So, I am needing to sum all billable hours within a table... the problem is that it is returning rouded decimals instead... like .5 always comes back as 1 ... <br />
<br />
Here is my procedure:<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; Public Shared Function GetBillableTimeForTicket(ByVal SupportTicketID As Integer) As Decimal<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim conn As New SqlConnection(GetConnectionString(&quot;ClientPortal.My.MySettings.conString&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim sP As String = &quot;GetBillableTimeForTicket&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim cmd As New SqlCommand()<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.Parameters.Clear()<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.CommandText = sP<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.CommandType = CommandType.StoredProcedure<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.Parameters.AddWithValue(&quot;@SupportTicketID&quot;, SupportTicketID)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim parameter1 As New SqlParameter(&quot;@TotalBillableTime&quot;, SqlDbType.Decimal)<br />
&nbsp; &nbsp; &nbsp; &nbsp; parameter1.Direction = ParameterDirection.Output<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.Parameters.Add(parameter1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.Connection = conn<br />
&nbsp; &nbsp; &nbsp; &nbsp; Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HandleConnection(conn)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd.ExecuteNonQuery()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dim totalBillableTime As Decimal = Decimal.Parse(cmd.Parameters(&quot;@TotalBillableTime&quot;).Value.ToString())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return totalBillableTime<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Catch ex As Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MsgBox(ex.Message)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Try<br />
&nbsp; &nbsp; &nbsp; &nbsp; Catch ex As Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MsgBox(ex.Message)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Finally<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HandleConnection(conn)<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Try<br />
&nbsp; &nbsp; End Function</pre><br />
And here is my StoredProcedure... I have tried so many variations of this SUM... Here is my latest...<br />
 <pre style="margin:20px; line-height:13px">ALTER PROCEDURE dbo.GetBillableTimeForTicket<br />
&nbsp; &nbsp; &nbsp; &nbsp; (<br />
&nbsp; &nbsp; &nbsp; &nbsp; @SupportTicketID int,<br />
&nbsp; &nbsp; &nbsp; &nbsp; @TotalBillableTime decimal (18,2) output<br />
&nbsp; &nbsp; &nbsp; &nbsp; )<br />
As<br />
&nbsp; Set NoCount On;<br />
&nbsp; <br />
&nbsp; SELECT @TotalBillableTime = ROUND(SUM(SupportTicketResponseBillableTime),2) FROM SupportTicketResponses WHERE SupportTicketID = @SupportTicketID;</pre><br />
Any help would be greatly appreciated, thank you in advance... Oh BTW... I'm using SQL 2008 with .NET 3.5</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>webwiredit</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238498.html</guid>
		</item>
		<item>
			<title>Combine all result into one variable</title>
			<link>http://www.daniweb.com/forums/thread238380.html</link>
			<pubDate>Fri, 13 Nov 2009 20:46:51 GMT</pubDate>
			<description>Hello, 
 
I am trying to make this code to combine the varchar string using fetch technique. 
The purpose for the code below is to combine all of the results and display back as 1 record instead of multiple records. 
 
We have SQL 2000 server. 
 
Thanks guys 
 
CREATE PROCEDURE get_all_clumns_name</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am trying to make this code to combine the varchar string using fetch technique.<br />
The purpose for the code below is to combine all of the results and display back as 1 record instead of multiple records.<br />
<br />
We have SQL 2000 server.<br />
<br />
Thanks guys<br />
<br />
 <pre style="margin:20px; line-height:13px">CREATE PROCEDURE get_all_clumns_name<br />
(<br />
@table_name&nbsp; varchar(200)<br />
)<br />
<br />
AS<br />
declare @current int<br />
declare @columns_names_holder varchar(500)<br />
declare @columns_names varchar(200)<br />
set @current=0<br />
DECLARE authors_cursor CURSOR FOR<br />
select&nbsp; top 5 col.name&nbsp;  from sysobjects obj inner join syscolumns col on obj.id = col.id where obj.name = @table_name ORDER BY col.name<br />
<br />
OPEN authors_cursor<br />
-- Perform the first fetch and store the values in variables.<br />
-- Note: The variables are in the same order as the columns<br />
<br />
--http://msdn.microsoft.com/en-us/library/aa258896(SQL.80).aspx<br />
FETCH NEXT FROM authors_cursor INTO @columns_names<br />
<br />
-- Check @@FETCH_STATUS to see if there are any more rows to fetch.<br />
<br />
WHILE @@FETCH_STATUS = 0<br />
<br />
BEGIN<br />
set @current=@current+1<br />
&nbsp;  -- This is executed as long as the previous fetch succeeds.<br />
set @columns_names_holder=@columns_names_holder+CONVERT(varchar(200), @columns_names_holder)<br />
&nbsp;  FETCH NEXT FROM authors_cursor&nbsp;  INTO @columns_names<br />
<br />
END<br />
<br />
CLOSE authors_cursor<br />
DEALLOCATE authors_cursor<br />
<br />
--output back the result<br />
select all_columns= @columns_names_holder<br />
GO</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>oimenoi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238380.html</guid>
		</item>
		<item>
			<title>Joining two views</title>
			<link>http://www.daniweb.com/forums/thread238295.html</link>
			<pubDate>Fri, 13 Nov 2009 14:50:53 GMT</pubDate>
			<description>Hi, this is giving me a major headache and my boss wants the project wrapped up asap : / 
 
I have two views pulling data from several tables. The end result is this: 
 
CustomerTotals 
CustomerID numeric(18,0), 
ProductID numeric(18,0), 
Delivered numeric(5,0), 
Ordered numeric(5,0)</description>
			<content:encoded><![CDATA[<div>Hi, this is giving me a major headache and my boss wants the project wrapped up asap : /<br />
<br />
I have two views pulling data from several tables. The end result is this:<br />
<br />
CustomerTotals<br />
CustomerID numeric(18,0),<br />
ProductID numeric(18,0),<br />
Delivered numeric(5,0),<br />
Ordered numeric(5,0)<br />
<br />
SupplierTotals<br />
SupplierID numeric(18,0),<br />
ProductID numeric(18,0),<br />
Delivered numeric(5,0),<br />
Ordered numeric(5,0)<br />
<br />
CustomerTotals shows total of orders we have recieved and items we have sent out. SupplierTotals shows the total we have ordered from our suppliers and how many we have so far received.<br />
<br />
I need to calculate some values from these but i tried to create the following view and each row is duplicated : /<br />
<br />
 <pre style="margin:20px; line-height:13px">SELECT&nbsp; &nbsp;  ISNULL(st.ProductID, ct.ProductID) AS 'ID', ISNULL(st.Ordered, 0) - ISNULL(st.Delivered, 0) AS [On Order], ISNULL(st.Delivered, 0) - ISNULL(ct.Delivered, 0) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS [In Stock], ISNULL(ct.Ordered, 0) - ISNULL(ct.Delivered, 0) AS [Orders Outstanding], ISNULL(st.Ordered, 0) - ISNULL(ct.Ordered, 0) AS Unassigned<br />
FROM&nbsp; &nbsp; &nbsp; &nbsp;  dbo.SupplierTotals AS st FULL OUTER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dbo.CustomerTotals AS ct ON st.ProductID = ct.ProductID</pre><br />
Can anyone shed some light on where i'm going wrong? C#.net is my strong suit...SQL is still a very alien language to me lol</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Ryshad</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238295.html</guid>
		</item>
		<item>
			<title>joining 3 tables messes up SUMS</title>
			<link>http://www.daniweb.com/forums/thread238101.html</link>
			<pubDate>Thu, 12 Nov 2009 19:51:29 GMT</pubDate>
			<description><![CDATA[I have a query that works, I wanted to add another sum from another table, but when I do, the all the SUM values are wrong 
this works 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I have a query that works, I wanted to add another sum from another table, but when I do, the all the SUM values are wrong<br />
this works<br />
 <pre style="margin:20px; line-height:13px">SELECT&nbsp; &nbsp;  Clients.ClientID, Clients.WholeName, <br />
SUM(CASE WHEN Payments.Creditorid = 0 THEN Payments.Amount ELSE 0.00 END) AS 'Admin Fees', <br />
SUM(CASE WHEN (Payments.Creditorid = 3) THEN Payments.amount ELSE 0.00 END) AS 'Retainer Fees', <br />
SUM(CASE WHEN (Payments.Creditorid = 4) THEN Payments.amount ELSE 0.00 END) AS 'Finance Fees', <br />
SUM(CASE WHEN (Payments.Creditorid = 2) THEN Payments.amount ELSE 0.00 END) AS 'NSF Fees', <br />
SUM(CASE WHEN Payments.bankaccountid = 0 THEN Payments.amount ELSE 0.00 END) AS Settlements&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
FROM&nbsp; &nbsp; &nbsp; &nbsp;  Clients LEFT OUTER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Payments ON Clients.ClientID = Payments.ClientID<br />
WHERE&nbsp; &nbsp;  (Clients.ClientID = 1126)<br />
GROUP BY Clients.ClientID, Clients.WholeName<br />
ORDER BY Clients.ClientID</pre><br />
this does not<br />
 <pre style="margin:20px; line-height:13px">SELECT&nbsp; &nbsp;  Clients.ClientID, Clients.WholeName, <br />
SUM(CASE WHEN Payments.Creditorid = 0 THEN Payments.Amount ELSE 0.00 END) AS 'Admin Fees', <br />
SUM(CASE WHEN (Payments.Creditorid = 3) THEN Payments.amount ELSE 0.00 END) AS 'Retainer Fees', <br />
SUM(CASE WHEN (Payments.Creditorid = 4) THEN Payments.amount ELSE 0.00 END) AS 'Finance Fees', <br />
SUM(CASE WHEN (Payments.Creditorid = 2) THEN Payments.amount ELSE 0.00 END) AS 'NSF Fees', <br />
SUM(CASE WHEN Payments.bankaccountid = 0 THEN Payments.amount ELSE 0.00 END) AS Settlements,<br />
&nbsp;SUM(Receipts.ReceiptAmount) AS 'Total Receipts'<br />
FROM&nbsp; &nbsp; &nbsp; &nbsp;  Clients LEFT OUTER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Receipts ON Clients.ClientID = Receipts.ClientID LEFT OUTER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Payments ON Clients.ClientID = Payments.ClientID<br />
WHERE&nbsp; &nbsp;  (Clients.ClientID = 1126)<br />
GROUP BY Clients.ClientID, Clients.WholeName<br />
ORDER BY Clients.ClientID</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>_taz_</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238101.html</guid>
		</item>
		<item>
			<title>Simple Database Question</title>
			<link>http://www.daniweb.com/forums/thread238086.html</link>
			<pubDate>Thu, 12 Nov 2009 18:41:47 GMT</pubDate>
			<description><![CDATA[Iam writing (or trying to write) a simple join query statement in Query Analyzer. As of right now Im getting the error message  
Ambiguous column name 'categoryID'. 
 
My Statement is ; 
 
Select categoryID, Max (StockPrice) as maxStockPrice, MIN(StockPrice) as minStockPrice, AVG(StockPrice) as...]]></description>
			<content:encoded><![CDATA[<div>Iam writing (or trying to write) a simple join query statement in Query Analyzer. As of right now Im getting the error message <br />
Ambiguous column name 'categoryID'.<br />
<br />
My Statement is ;<br />
<br />
 <pre style="margin:20px; line-height:13px">Select categoryID, Max (StockPrice) as maxStockPrice, MIN(StockPrice) as minStockPrice, AVG(StockPrice) as avgStockPrice<br />
From Category, InventoryPart<br />
Where Category.CategoryID = InventoryPart.CategoryID;</pre><br />
<br />
Im thinking it has something to do with the fact that SQL isn't sure if it should pull the column categoryID from the Category Table or InventoryPart Table.<br />
<br />
1) Am I correct in thinking the above <br />
2) how do I fix it?<br />
<br />
Any Help Would be Greatly Appreciated</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>geek_till_itMHZ</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238086.html</guid>
		</item>
		<item>
			<title>Problem with Datepart</title>
			<link>http://www.daniweb.com/forums/thread238036.html</link>
			<pubDate>Thu, 12 Nov 2009 14:12:27 GMT</pubDate>
			<description><![CDATA[Good Day all 
 
i have the Following Query 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a>...]]></description>
			<content:encoded><![CDATA[<div>Good Day all<br />
<br />
i have the Following Query<br />
 <pre style="margin:20px; line-height:13px">DECLARE @CurrentTime DATETIME<br />
SET @CurrentTime = CURRENT_TIMESTAMP<br />
select tr.Descr [Room], tb.Purpose [Purpose], tb.Description [Description],<br />
convert(varchar,datepart(hour,tb.starttime))+':'+convert(varchar,datepart(minute,tb.starttime)) [Start Time],<br />
convert(varchar,datepart(hour,tb.endtime))+':'+convert(varchar,datepart(minute,tb.endtime)) [End Time],<br />
tu.name [Requested by] from tbl_booking tb inner join tbl_resource tr<br />
on tb.resources = tr.id<br />
inner join tbl_user tu on tu.id = tb.RequestedByUser<br />
where (day(startdate) = day(@CurrentTime))and(month(startdate)=month(@CurrentTime))and(year(startdate)=year(@CurrentTime))and(tb.status=1)<br />
order by [Room],[Start Time]</pre><br />
and in the [Start Time]and [End Time] it gives me time that is not Complete<br />
<br />
it Gives this<br />
<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  14:0  <hr /> </td> </tr> </table> </div><br />
instead of<br />
<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />   14:00  <hr /> </td> </tr> </table> </div>Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238036.html</guid>
		</item>
		<item>
			<title>SQL Bulk import routine</title>
			<link>http://www.daniweb.com/forums/thread238001.html</link>
			<pubDate>Thu, 12 Nov 2009 11:22:15 GMT</pubDate>
			<description><![CDATA[I am trying to write a bulk import routine so that i will be able to import text files or csv files to SQL i have tried this and it's giving me the following error message. P: is the drive where the file is in currently. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I am trying to write a bulk import routine so that i will be able to import text files or csv files to SQL i have tried this and it's giving me the following error message. P: is the drive where the file is in currently.<br />
 <pre style="margin:20px; line-height:13px">USE [XYZABQ]<br />
GO<br />
CREATE TABLE CSVTest<br />
(ID INT,<br />
[Name] VARCHAR(40),<br />
Surname VARCHAR(40),<br />
BirthDate DATETIME (10))<br />
GO<br />
BULK<br />
INSERT CSVTest<br />
FROM 'P:\csvtest.txt'<br />
WITH<br />
(<br />
FIELDTERMINATOR = ',',<br />
ROWTERMINATOR = '\n'<br />
)<br />
GO</pre><span style="color:Green">Error Message</span><br />
<span style="color:red">Msg 4861, Level 16, State 1, Line 2<br />
Cannot bulk load because the file &quot;P:\csvtest.txt&quot; could not be opened. Operating system error code 3(error not found).</span></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>wchitamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238001.html</guid>
		</item>
		<item>
			<title>SQL 2005</title>
			<link>http://www.daniweb.com/forums/thread237829.html</link>
			<pubDate>Wed, 11 Nov 2009 19:54:44 GMT</pubDate>
			<description><![CDATA[Hi, 
I am doing a project where i am creating a website with a SQL server 2005 DB in the backend. I am doing it using visual studio.net and coding in C#, ASP.NET & CSS. 
As a person registers on the website, the info goes to the DB but i want an email to be sent automatically to the person saying...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
I am doing a project where i am creating a website with a SQL server 2005 DB in the backend. I am doing it using visual studio.net and coding in C#, ASP.NET &amp; CSS.<br />
As a person registers on the website, the info goes to the DB but i want an email to be sent automatically to the person saying they have registered successfully,.<br />
What is the best way of doing this??<br />
Please Help<br />
<br />
:)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Rebel1</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237829.html</guid>
		</item>
		<item>
			<title>SSIS skip bad row</title>
			<link>http://www.daniweb.com/forums/thread237782.html</link>
			<pubDate>Wed, 11 Nov 2009 15:49:02 GMT</pubDate>
			<description><![CDATA[I have a SSIS import file that imports a flat file that is in cvs format. I've been running into a problem where the input file that is retrieved from a third party has bad rows in it. These rows cause the import process to fail and it doesn't fully update the database. Is there a way to tell the...]]></description>
			<content:encoded><![CDATA[<div>I have a SSIS import file that imports a flat file that is in cvs format. I've been running into a problem where the input file that is retrieved from a third party has bad rows in it. These rows cause the import process to fail and it doesn't fully update the database. Is there a way to tell the SSIS package to skip any rows that can't be imported? Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>csihosting</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237782.html</guid>
		</item>
		<item>
			<title>create multiple rows based on data</title>
			<link>http://www.daniweb.com/forums/thread237759.html</link>
			<pubDate>Wed, 11 Nov 2009 13:58:44 GMT</pubDate>
			<description>Dear all, 
 
I’m stuck on a problem which I’m hoping someone might be able to help with in an SQL script. 
 
I have a table with RAW Timesheet data which includes entries for Absences. When someone enters a timesheet on a particular date for a two week holiday, if I report on the amount of hours...</description>
			<content:encoded><![CDATA[<div>Dear all,<br />
<br />
I’m stuck on a problem which I’m hoping someone might be able to help with in an SQL script.<br />
<br />
I have a table with RAW Timesheet data which includes entries for Absences. When someone enters a timesheet on a particular date for a two week holiday, if I report on the amount of hours recorded in the first week, it brings into account the next week’s absences as well.<br />
My solution is that, when the data is imported from the Timesheet system into the SQL database, I want it to identify Absence records greater than one day and then create multiple records for each day taken. This way, I will always get accurate reports regardless of the date range of a report.<br />
I am not great at scripting and am a little out of my depth but thought I would include where I have got up to (stuck though it be) to see if someone can see how to do this better or correct my mistakes.<br />
<br />
The Timesheet record comes from a Timesheet table which is imported from a TXT file. The TimeDate field is the date the timesheet is entered OR the date for the first day’s holiday. The AbsenceDays field is how many days.<br />
<br />
What I want to do is create a new record for every single day BUT, as it is creating each record, check the date against a Calendar table which checks to see if the proposed new record date is a WorkDay or not. The calendar has a [Date] field and a WorkDay Y/N field which is set to No if it is a weekend or is a Public Holiday.<br />
<br />
Each Record it creates INTO a new table called Absences (which I haven’t included – but know needs to go after the print DATEADD but don’t know what to add) and the TimeDate is modified to the date created from the @counter increment and each AbsenceDays is set to 1 with exception to any remainder on the last record (like in the example of 3.5 days – records for 1, 1, 1, 0.5 would be created).<br />
<br />
Sorry if this all looks convoluted but I wanted to ensure I explained myself fully before posting. Thank you all in advance.<br />
<br />
Kind Regards<br />
<br />
Matt<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
-- ****** Modified Version ******<br />
<br />
declare @StartDate datetime<br />
declare @Days int<br />
declare @counter int<br />
<br />
set @StartDate = dbo.Timesheets.TimeDate<br />
<br />
if dbo.timesheets.AbsenceDays = &lt;1 THEN<br />
end<br />
else<br />
<br />
set @counter = 0<br />
<br />
-- The reason why counter is set to 0 and not 1 is because I want to create the initial record with the Timesheet date+0.&nbsp; This is because I do not want to keep the original record that is being used to duplicate and create each day timesheet.<br />
<br />
while(@counter &lt;= dbo.timesheets.AbsenceDays)<br />
begin<br />
<br />
-- Somehow need to specify a relationship between dbo.Calendar.[Date] and dbo.timesheets.DateTime+@counter<br />
<br />
CASE WHEN(dbo.Calendar.WorkDay = “Y” THEN continue ELSE @counter = @counter+1 redo case END)<br />
<br />
-- Above case done to ensure that the date it is about to add is not a Sunday or Saturday or public holiday.&nbsp; Don’t know how to format it correctly.<br />
<br />
print DATEADD(day, @counter, @StartDate)<br />
<br />
-- I know I can insert record here but don’t know how.&nbsp; I want the same details as the original record being checked by the script but the TimeDate field to be changed to the new date and the AbsenceDays field to be set to 1 per records.&nbsp; In addition, if the absences are 3.5 days, I would need FOUR records created – 1, 1, 1, 0.5.&nbsp; When adding these records, how would I get it to create records which are not simply divided by 4? (namely 0.87 days per record)[/green]<br />
<br />
set @counter = @counter + 1<br />
end</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mattlightbourn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237759.html</guid>
		</item>
		<item>
			<title>SQL</title>
			<link>http://www.daniweb.com/forums/thread237665.html</link>
			<pubDate>Wed, 11 Nov 2009 06:38:53 GMT</pubDate>
			<description><![CDATA[Hi  
 
I need a help in SQL,There is  table called sales.Its contains the day,sales quantity.If I write sql like below  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680"...]]></description>
			<content:encoded><![CDATA[<div>Hi <br />
<br />
I need a help in SQL,There is  table called sales.Its contains the day,sales quantity.If I write sql like below <br />
<br />
 <pre style="margin:20px; line-height:13px">select day,Sales_quantity from Sales.</pre><br />
Then result should be <br />
Day                         SalesQuantity<br />
Monday                    20<br />
Monday                    302<br />
Monday                   50<br />
Tuseday                   30<br />
etc..<br />
<br />
The problem is I want  to  get result like below<br />
<br />
Day                           SalesQuantity<br />
Monday                    20,302,50<br />
Tuesday                    30<br />
<br />
There should be ',' sign between two values.How Do I write this kind of SQL.<br />
<br />
Thanks<br />
Tank50</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Tank50</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237665.html</guid>
		</item>
		<item>
			<title>Stored Procedures to insert into a table</title>
			<link>http://www.daniweb.com/forums/thread237434.html</link>
			<pubDate>Tue, 10 Nov 2009 09:21:40 GMT</pubDate>
			<description><![CDATA[I have some tables that i have created in SQL Server and i want to write a stored Procedure that will insert data on to one of my tables AND also be able to update say if i select record 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I have some tables that i have created in SQL Server and i want to write a stored Procedure that will insert data on to one of my tables AND also be able to update say if i select record<br />
 <pre style="margin:20px; line-height:13px">CREATE PROCEDURE Sp_cust_SaveCustomer<br />
--ALTER PROCEDURE cust_SaveCustomer<br />
(@id int, <br />
@ Surname varchar(50),<br />
@ Initials varchar(50),<br />
@ SEX_CODE varchar(50)) <br />
AS IF @id=-1 <br />
BEGIN INSERT INTO cust_Customer(Surname,Initials,SEX_CODE) <br />
SELECT @ Surname,@ Initials,@SEX_CODE&nbsp;  <br />
SELECT @@identity <br />
END <br />
ELSE<br />
BEGIN UPDATE cust_Customer <br />
SET <br />
Surname= @ Surname ,<br />
Initials =@ Initials ,<br />
SEX_CODE =@ SEX_CODE&nbsp;  <br />
WHERE id=@id <br />
SELECT @id <br />
END</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>wchitamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237434.html</guid>
		</item>
		<item>
			<title>Restore Database from a Remote Backup</title>
			<link>http://www.daniweb.com/forums/thread237240.html</link>
			<pubDate>Mon, 09 Nov 2009 14:39:02 GMT</pubDate>
			<description>Good Day All 
 
am restoring a Database Programatically in Sql. Now if the backup is located in the remote machine i use a Share 
 
 
---Quote--- 
\\Vuyiswa\MyShare\ 
---End Quote---</description>
			<content:encoded><![CDATA[<div>Good Day All<br />
<br />
am restoring a Database Programatically in Sql. Now if the backup is located in the remote machine i use a Share<br />
<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  \\Vuyiswa\MyShare\  <hr /> </td> </tr> </table> </div><br />
<br />
but i will get the Following Error<br />
<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  Exception caught in: ExecuteStoredProc: The file &quot;\\Vuyiswa\Databases\\REmoteTest33.mdf&quot; is on a network path that is not supported for database files. File 'TNGoedit_Data' cannot be restored to '\\Vuyiswa\Databases\\REmoteTest33.mdf'. Use WITH MOVE to identify a valid location for the file. The file &quot;\\Vuyiswa\Databases\\REmoteTest33_log.ldf&quot; is on a network path that is not supported for database files. File 'TNGoedit_Log' cannot be restored to '\\Vuyiswa\Databases\\REmoteTest33_log.ldf'. Use WITH MOVE to identify a valid location for the file. Problems were identified while planning for the RESTORE statement. Previous messages provide details. RESTORE DATABASE is terminating abnormally. Database 'REmoteTest33' does not exist. Make sure that the name is entered correctly.   <hr /> </td> </tr> </table> </div><br />
<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237240.html</guid>
		</item>
		<item>
			<title>is there a way to make an image data type as index?</title>
			<link>http://www.daniweb.com/forums/thread237178.html</link>
			<pubDate>Mon, 09 Nov 2009 09:30:17 GMT</pubDate>
			<description>or even make the searching faster when retreiving data. please kindly help me. thnx.</description>
			<content:encoded><![CDATA[<div>or even make the searching faster when retreiving data. please kindly help me. thnx.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>brenn13</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread237178.html</guid>
		</item>
		<item>
			<title>Delete Rows</title>
			<link>http://www.daniweb.com/forums/thread236999.html</link>
			<pubDate>Sun, 08 Nov 2009 15:23:25 GMT</pubDate>
			<description><![CDATA[Hi 
 
I wonder how I do to remove usersid from 1915 to 1945 for example in MS Sql? 
 
Delete from [dbo].[user] where user ID = 1915 to userID 1945 
When i add that i get this message: 
 
Msg 156, Level 15, State 1, Line 2 
Incorrect syntax near the keyword 'to'. 
Msg 156, Level 15, State 1, Line 3]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
<br />
I wonder how I do to remove usersid from 1915 to 1945 for example in MS Sql?<br />
<br />
 <pre style="margin:20px; line-height:13px">Delete from &#91;dbo&#93;.&#91;user&#93; where user ID = 1915 to userID 1945</pre><br />
When i add that i get this message:<br />
<br />
Msg 156, Level 15, State 1, Line 2<br />
Incorrect syntax near the keyword 'to'.<br />
Msg 156, Level 15, State 1, Line 3<br />
Incorrect syntax near the keyword 'to'.<br />
<br />
Can someone please tell me what is wrong?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Kaddolas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236999.html</guid>
		</item>
		<item>
			<title>MS SQL Recursion problem</title>
			<link>http://www.daniweb.com/forums/thread236984.html</link>
			<pubDate>Sun, 08 Nov 2009 13:26:28 GMT</pubDate>
			<description>I have following tables 
table1 
nr_key1 
nr_dad1 
 
table2 
nr_key2 
value 
(repeated ~n times with same nr_key2 and different value)</description>
			<content:encoded><![CDATA[<div>I have following tables<br />
table1<br />
nr_key1<br />
nr_dad1<br />
<br />
table2<br />
nr_key2<br />
value<br />
(repeated ~n times with same nr_key2 and different value)<br />
<br />
in table2 nr_key1 = nr_key2<br />
<br />
After I have iterated through nr_key1 I want to use recursion to select nr_key1 = nr_dad1 and iterate again table2 with the new nr_key1. This should be repeated as long as nr_dad1 is null. I have succesfully got the result but only if nr_key1 = nr_key2 contains values. If table2 is empty for the current nr_key1 my recursion is broken. I receive error if I try to use outer join in my recursion. Also my current solution is quite slow, because I am iterating the whole hierarchy again from each value found in table2. Is it possible to implement some sort of a check?<br />
<br />
Maybe my approach is wrong? Any suggestions will be highly appreciated thanks.<br />
<br />
 <pre style="margin:20px; line-height:13px">with test (NR_KEY1, NR_DAD1, VALUE, leveli)&nbsp; <br />
AS<br />
(<br />
select a.NR_KEY1, a.NR_DAD1, VALUE,<br />
1 as leveli<br />
from table1<br />
right outer join table2 a ON<br />
NR_KEY2 = a.NR_KEY1 where a.NR_KEY1 = 10020<br />
<br />
union all<br />
<br />
select a.NR_KEY1, a.NR_DAD1, e.VALUE, <br />
eh.leveli + 1 as leveli<br />
from table1 e<br />
&nbsp; &nbsp; &nbsp; &nbsp; inner join table2 a ON<br />
&nbsp; &nbsp; &nbsp; &nbsp; e.NR_KEY2 = a.NR_KEY1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inner join test eh ON <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.NR_KEY2 = eh.NR_DAD1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; where e.NR_KEY2 = eh.NR_DAD1<br />
)<br />
select * from test order by leveli</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>elauri</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236984.html</guid>
		</item>
		<item>
			<title>Retrieve row based column having null value in sql2000</title>
			<link>http://www.daniweb.com/forums/thread236768.html</link>
			<pubDate>Sat, 07 Nov 2009 11:59:05 GMT</pubDate>
			<description>Hello 
   i wish to retrieve rows from  a table based on a particular column which contains null values in sql2000 server I try ed a lot but its not working please help me.</description>
			<content:encoded><![CDATA[<div>Hello<br />
   i wish to retrieve rows from  a table based on a particular column which contains null values in sql2000 server I try ed a lot but its not working please help me.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>shine_jose</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236768.html</guid>
		</item>
		<item>
			<title>Tables appear under wrong database in SQL Server Mgmt. Studio Express</title>
			<link>http://www.daniweb.com/forums/thread236606.html</link>
			<pubDate>Fri, 06 Nov 2009 16:54:58 GMT</pubDate>
			<description><![CDATA[Whenever I create a new database from a C# program and create tables for that database, the tables always show up under the creator's default database instead of being listed under the newly created database. This observation is from Microsoft SQL Server Management Studio Express. Is there some...]]></description>
			<content:encoded><![CDATA[<div>Whenever I create a new database from a C# program and create tables for that database, the tables always show up under the creator's default database instead of being listed under the newly created database. This observation is from Microsoft SQL Server Management Studio Express. Is there some setting in Microsoft SQL Server Management Studio Express that I may apply to the users to remedy this?<br />
<br />
FYI: SQL Server 9.0.3042<br />
       SQL Server Management Studio Express 9.00.2047.00</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>lukeser</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236606.html</guid>
		</item>
		<item>
			<title>Connect by prior command</title>
			<link>http://www.daniweb.com/forums/thread236562.html</link>
			<pubDate>Fri, 06 Nov 2009 12:54:36 GMT</pubDate>
			<description>Hi All, 
Can anybody give me a solution how to solve or write a query for this scenario? 
 
there is table called ITT1 with the columns 
 
FATHER, CHILD_NUM, CODE, CODE_QTY 
a 1 b 1 
b 1 c 1.5 
c 1 d 2 
d 1 e 1</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
Can anybody give me a solution how to solve or write a query for this scenario?<br />
<br />
there is table called ITT1 with the columns<br />
<br />
FATHER, CHILD_NUM, CODE, CODE_QTY<br />
a 1 b 1<br />
b 1 c 1.5<br />
c 1 d 2<br />
d 1 e 1<br />
<br />
There are 3 columns father,child_num,code &amp; the code_quantity.<br />
It is explained as 'a' is my FINAL finished good and is produced from raw material 'b' using 1kg.<br />
and here 'b' becomes my finished good and is produced from raw material 'c' using 1kg.<br />
and here 'c' becomes my finished good and is produced from raw material 'd' using 1kg.<br />
and here 'd' becomes my finished good and is produced from raw material 'e' using 1kg.<br />
<br />
now i want how much raw material 'e' is required to produced for eg. 20kg of 'a'<br />
<br />
should i use connect by prior or sub queries will help in this regards.<br />
kindly advice.<br />
<br />
Regards,<br />
Faheem</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>sk.faheemuddin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236562.html</guid>
		</item>
		<item>
			<title>LEFT JOIN problem</title>
			<link>http://www.daniweb.com/forums/thread236427.html</link>
			<pubDate>Fri, 06 Nov 2009 00:11:40 GMT</pubDate>
			<description>Hi All! 
 
I have 3 tables: 
 
test1 
id     name1 
 1     value1 
 
test2 
id     name2</description>
			<content:encoded><![CDATA[<div>Hi All!<br />
<br />
I have 3 tables:<br />
<br />
test1<br />
id     name1<br />
 1     value1<br />
<br />
test2<br />
id     name2<br />
 1     value2<br />
<br />
test3<br />
id     name3<br />
 3     value3_01<br />
 4     value3_02<br />
<br />
I want to display all records of table test1 with values of table test2 (test1.id = test2.id) and values of test3 (if test.id match with test1.id) - in this case test3 has no common ids with test1  so NULLs are displayed.<br />
How to make sql query to display:<br />
id1     name1   name2    name3<br />
   1     value1   value2     NULL<br />
<br />
I constructed query:<br />
 <pre style="margin:20px; line-height:13px">SELECT t1.id as id1, t1.name1 as name1, t2.name2 as name2, t3.name3 as name3<br />
FROM (test1 t1) LEFT JOIN (test3 t3, test2 t2)<br />
ON (t1.id=t2.id and t1.id=t3.id)</pre>but it gives me:<br />
<br />
id1     name1  name2   name3<br />
   1     value1   NULL     NULL<br />
<br />
name2 is NULL instead of desired &quot;value2&quot;. WHY?<br />
<br />
LEFT JOIN DEFINITION:<br />
SQL LEFT JOIN Keyword<br />
The LEFT JOIN keyword returns all rows from the left table, even if there are no matches in the right table.<br />
<br />
There are no matches in test3 table when joining test1 table so name3 from table3 is NULL in result.<br />
<br />
BUT There are matches in table test2 (test2.id=1 and test1.id=1) so why null is displayed?<br />
<br />
Hope anyone can help me. I am in big trouble.<br />
 <br />
Thanks in advace.<br />
Tom</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>pc131</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236427.html</guid>
		</item>
		<item>
			<title><![CDATA['UPDATE'ing table with same value over and over again!]]></title>
			<link>http://www.daniweb.com/forums/thread236359.html</link>
			<pubDate>Thu, 05 Nov 2009 19:44:33 GMT</pubDate>
			<description><![CDATA[One of the UPDATE queries I am trying to run is not quite working the way I want it to. I know this query is the culprit, but can't quite figure out how to fix it! Here's the story: 
------------------------------------------------------- 
I have 3 tables: let's call them tblUsers, tblDueVisits and...]]></description>
			<content:encoded><![CDATA[<div>One of the UPDATE queries I am trying to run is not quite working the way I want it to. I know this query is the culprit, but can't quite figure out how to fix it! Here's the story:<br />
-------------------------------------------------------<br />
I have 3 tables: let's call them tblUsers, tblDueVisits and tblWindows<br />
tblUsers:  UserID (PK, int), FirstName (char), LastName (char), BirthDate (smalldatetime), etc.<br />
tblDueVisits: UserID (int), DueDate (smalldatetime), WindowName(char). UserID + DueDate together make up the key for this table.<br />
tblWindows: WindowID (int), WindowName (varchar)<br />
tblWindows stores a pre-defined maximum number of records (say 10). This table will, at least, theoretically never change.<br />
Now this is what I have to do:<br />
•	Check how many records a particular User ID (say ID # 1) has in tblDueVisits. For the sake of this example assume there are 5 records.<br />
•	Next, SELECT the TOP 5 WindowName from tblWindows.<br />
•	UPDATE tblDueVisits to store the WindowName in tblDueVisits WHERE UserID = 1.<br />
(The front-end user selects an ID# from a web page’s drop down box)<br />
-----------------------------------------------------<br />
I have written the T-SQL loop statements to do this, but somehow the UPDATE doesn’t work. Specifically, what happens is that the same WindowName gets written 5 times rather than writing the 5 different WindowNames once each!!<br />
<br />
Let me know if I wasn't totally clear about something, or if you need me to post the code for this.<br />
<br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>SQL_n00b</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236359.html</guid>
		</item>
		<item>
			<title>strong sa password error</title>
			<link>http://www.daniweb.com/forums/thread236119.html</link>
			<pubDate>Thu, 05 Nov 2009 02:52:06 GMT</pubDate>
			<description><![CDATA[hello 
i m using a library management software for which i need sql server 
while installing ms sql 2005 at one point installer gives me this message and throw me out. the message is " To continue, you must provide a strong sa password. To review strong password requirements, click Help on the...]]></description>
			<content:encoded><![CDATA[<div>hello<br />
i m using a library management software for which i need sql server<br />
while installing ms sql 2005 at one point installer gives me this message and throw me out. the message is &quot; To continue, you must provide a strong sa password. To review strong password requirements, click Help on the Authentication Mode page.<br />
<br />
For help, click: http://go.microsoft.com/fwlink?LinkID=20476&amp;ProdName=Microsoft+SQL+Server&amp;ProdVer=9.00.4035.00&amp;EvtSrc=setup.rll&amp;EvtID=SQLSetup90&amp;EvtType=28000&quot;<br />
i cannot complete the installation even after giving various passwords<br />
<br />
pl help me<br />
<br />
thanx in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>bmanish</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236119.html</guid>
		</item>
		<item>
			<title>Get records from current year</title>
			<link>http://www.daniweb.com/forums/thread235940.html</link>
			<pubDate>Wed, 04 Nov 2009 11:33:05 GMT</pubDate>
			<description>Dear SQL sharks.... 
 
Please somebody help me with this struggle. I have been searching the web for hours now. 
 
I have a table with sales data. In this table i have a columne called SalesAmount, CustomerName and SalesDate(the format i smalldatetime) 
 
Now I would like to retreive all the...</description>
			<content:encoded><![CDATA[<div>Dear SQL sharks....<br />
<br />
Please somebody help me with this struggle. I have been searching the web for hours now.<br />
<br />
I have a table with sales data. In this table i have a columne called SalesAmount, CustomerName and SalesDate(the format i smalldatetime)<br />
<br />
Now I would like to retreive all the records where SalesDate is within current year...How do I do this??<br />
I want to make a sum of this years sales numbers and when i pass newsyear it should start from zero again.<br />
<br />
I really hope somebody can help me!!<br />
<br />
Kristian</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>21KristianN</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235940.html</guid>
		</item>
		<item>
			<title>SSIS Variable is Empty</title>
			<link>http://www.daniweb.com/forums/thread235662.html</link>
			<pubDate>Tue, 03 Nov 2009 13:24:03 GMT</pubDate>
			<description>Good Day all 
 
i have created a Global Variable as depicted in the following Pic 
 
http://www.tiyaneproperties.co.za/SSIS/pic1.JPG 
 
The Following Screen-shot shows how i created my Variable and its Properties 
 
http://www.tiyaneproperties.co.za/SSIS/pic2.JPG 
...</description>
			<content:encoded><![CDATA[<div>Good Day all<br />
<br />
i have created a Global Variable as depicted in the following Pic<br />
<br />
<a rel="nofollow" class="t" href="http://www.tiyaneproperties.co.za/SSIS/pic1.JPG" target="_blank">http://www.tiyaneproperties.co.za/SSIS/pic1.JPG</a><br />
<br />
The Following Screen-shot shows how i created my Variable and its Properties<br />
<br />
<a rel="nofollow" class="t" href="http://www.tiyaneproperties.co.za/SSIS/pic2.JPG" target="_blank">http://www.tiyaneproperties.co.za/SSIS/pic2.JPG<br />
</a><br />
<br />
and the Following Screen-shot shows the Script Editor Properties<br />
<a rel="nofollow" class="t" href="http://www.tiyaneproperties.co.za/SSIS/pic3.JPG" target="_blank"><br />
http://www.tiyaneproperties.co.za/SSIS/pic3.JPG</a><br />
<br />
and the Last pic is the code that write to the XML File<br />
<br />
<a rel="nofollow" class="t" href="http://www.tiyaneproperties.co.za/SSIS/pic4.JPG" target="_blank">http://www.tiyaneproperties.co.za/SSIS/pic4.JPG</a><br />
<br />
The Variable comes back empty and at the end the file comes back empty. So i added a if statement as you can see to make sure that the part that write to the file has no problems.<br />
<br />
Thank you</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235662.html</guid>
		</item>
		<item>
			<title>Integer or Numeric</title>
			<link>http://www.daniweb.com/forums/thread235596.html</link>
			<pubDate>Tue, 03 Nov 2009 09:18:15 GMT</pubDate>
			<description><![CDATA[Hi, 
I've imported a Visual FoxPro database to MS SQL Server 2008 and had a couple of queries; 
The VFP tables used Numeric(5,0) for the Index fields, but I'm thinking of converting them to Integers in SQL Server. Is there any issues I should be aware of? A co-worker keeps telling me that Integers...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
I've imported a Visual FoxPro database to MS SQL Server 2008 and had a couple of queries;<br />
The VFP tables used Numeric(5,0) for the Index fields, but I'm thinking of converting them to Integers in SQL Server. Is there any issues I should be aware of? A co-worker keeps telling me that Integers are &quot;slower&quot; to search on, which I find a bit hard to believe. I always thought that you would you use Numerics for data that requires precision, such as financial data and Integers for counters whole number id's and so on. Am I wrong or missing something?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Wenners</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235596.html</guid>
		</item>
		<item>
			<title>insert date</title>
			<link>http://www.daniweb.com/forums/thread235554.html</link>
			<pubDate>Tue, 03 Nov 2009 04:31:46 GMT</pubDate>
			<description>how to insert system current date by using sql query in  SQL SERVER 2005</description>
			<content:encoded><![CDATA[<div>how to insert system current date by using sql query in  SQL SERVER 2005</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>pavankotturi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235554.html</guid>
		</item>
		<item>
			<title>Extract table statistics DDL</title>
			<link>http://www.daniweb.com/forums/thread235483.html</link>
			<pubDate>Mon, 02 Nov 2009 21:58:37 GMT</pubDate>
			<description><![CDATA[Hello everyone, 
 
I searched extensively but was unable to find a solution to this problem. I'm attempting to generate the CREATE STATISTICS statement that was used to create an already existing statistics in an MSSQL db from its name or the table's name. I'm able to obtain the columns and the...]]></description>
			<content:encoded><![CDATA[<div>Hello everyone,<br />
<br />
I searched extensively but was unable to find a solution to this problem. I'm attempting to generate the CREATE STATISTICS statement that was used to create an already existing statistics in an MSSQL db from its name or the table's name. I'm able to obtain the columns and the filter definition, but I cannot find anywhere that specifies the &quot;FULLSCAN&quot;, &quot;SAMPLE&quot; and &quot;STATS_STREAM&quot; WITH options. I am querying the sys.stats and sys.stats_columns.<br />
<br />
Please help me out with this! Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vkubushyn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235483.html</guid>
		</item>
		<item>
			<title>Union identical tables in one view</title>
			<link>http://www.daniweb.com/forums/thread235451.html</link>
			<pubDate>Mon, 02 Nov 2009 19:43:47 GMT</pubDate>
			<description>Hello all, 
 
my first post. 
 
I have identical tables in my db. Is there a way to create a view with dynamic query to combine/union all the identical tables into one view? 
 
dbo.table.x-1 
dbo.table.x-2 
dbo.table.x-3 
dbo.table.x-{n}</description>
			<content:encoded><![CDATA[<div>Hello all,<br />
<br />
my first post.<br />
<br />
I have identical tables in my db. Is there a way to create a view with dynamic query to combine/union all the identical tables into one view?<br />
<br />
dbo.table.x-1<br />
dbo.table.x-2<br />
dbo.table.x-3<br />
dbo.table.x-{n}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>elauri</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235451.html</guid>
		</item>
		<item>
			<title>SSRS delete blank rows</title>
			<link>http://www.daniweb.com/forums/thread235365.html</link>
			<pubDate>Mon, 02 Nov 2009 14:30:05 GMT</pubDate>
			<description>i am using SSRS 2005. In my dataset there are some blank rows and in SSRS is showing blank rows. Is there a way that i just show rows with data and ignore blank rows. i set the visibility property but it is showing blank line. 
 
dataset: 
 
a 
b 
c 
blank 
d 
blank</description>
			<content:encoded><![CDATA[<div>i am using SSRS 2005. In my dataset there are some blank rows and in SSRS is showing blank rows. Is there a way that i just show rows with data and ignore blank rows. i set the visibility property but it is showing blank line.<br />
<br />
dataset:<br />
<br />
a<br />
b<br />
c<br />
blank<br />
d<br />
blank<br />
blank<br />
e<br />
<br />
i want output like:<br />
<br />
a<br />
b<br />
c<br />
d<br />
e<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>azamsalam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235365.html</guid>
		</item>
		<item>
			<title>Help BCP The Following Query</title>
			<link>http://www.daniweb.com/forums/thread235317.html</link>
			<pubDate>Mon, 02 Nov 2009 10:34:19 GMT</pubDate>
			<description><![CDATA[Good Day All  
 
I have the Following Query  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code...]]></description>
			<content:encoded><![CDATA[<div>Good Day All <br />
<br />
I have the Following Query <br />
 <pre style="margin:20px; line-height:13px">DECLARE @CurrentTime DATETIME<br />
SET @CurrentTime = CURRENT_TIMESTAMP<br />
select tr.Descr [Room], tb.Purpose [Purpose], tb.Description [Description],<br />
convert(varchar,datepart(hour,tb.starttime))+':'+convert(varchar,datepart(minute,tb.starttime)) [Start Time],<br />
convert(varchar,datepart(hour,tb.endtime))+':'+convert(varchar,datepart(minute,tb.endtime)) [End Time],<br />
tu.name [Requested by] from tbl_booking tb inner join tbl_resource tr<br />
on tb.resources = tr.id<br />
inner join tbl_user tu on tu.id = tb.RequestedByUser<br />
where (day(startdate) = day(@CurrentTime))and(month(startdate)=month(@CurrentTime))and(year(startdate)=year(@CurrentTime))and(tb.status=1)<br />
order by [Room],[Start Time]<br />
for xml raw</pre><br />
This creates an XML, but now i want to store it in <br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  C:\X.XML  <hr /> </td> </tr> </table> </div>how can i BCP this Query <br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235317.html</guid>
		</item>
		<item>
			<title>SQL question releated to group by</title>
			<link>http://www.daniweb.com/forums/thread235316.html</link>
			<pubDate>Mon, 02 Nov 2009 10:32:49 GMT</pubDate>
			<description>Hi, 
 
I hope someone can help me creating a sql for the purpose i have. 
 
I have a table named case_score_t with these columns: 
id, case_id, user_id, score, created_date 
 
I am interested in picking the rows with the greatest created_date, for a certain user_id. 
 
I now this SQL with give me...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I hope someone can help me creating a sql for the purpose i have.<br />
<br />
I have a table named case_score_t with these columns:<br />
id, case_id, user_id, score, created_date<br />
<br />
I am interested in picking the rows with the greatest created_date, for a certain user_id.<br />
<br />
I now this SQL with give me the result:<br />
 <pre style="margin:20px; line-height:13px">SELECT *, max(created) FROM case_score_t cs WHERE cs.user_id = 1449 GROUP BY cs.case_id;</pre><br />
The problem is that i have is that i get an extra column, the max(created) column back.<br />
<br />
Is there anyway to do the same query(maybe with subselect's or something), without getting the extra column.<br />
<br />
So basically i want something like:  <pre style="margin:20px; line-height:13px">SELECt * FROM ......</pre>and is should return the same result.<br />
<br />
Thanks in advance.<br />
Cemils</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Cemils</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235316.html</guid>
		</item>
		<item>
			<title>syntax query for backup database for one month in sql server 2000</title>
			<link>http://www.daniweb.com/forums/thread235205.html</link>
			<pubDate>Mon, 02 Nov 2009 01:55:25 GMT</pubDate>
			<description><![CDATA[hi, 
 
how the way backup database in sql server 2000 with syntax sql for one month, i mean query. Thank's]]></description>
			<content:encoded><![CDATA[<div>hi,<br />
<br />
how the way backup database in sql server 2000 with syntax sql for one month, i mean query. Thank's</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>hery</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235205.html</guid>
		</item>
		<item>
			<title>Stored Procedure with Increments</title>
			<link>http://www.daniweb.com/forums/thread234691.html</link>
			<pubDate>Fri, 30 Oct 2009 13:44:53 GMT</pubDate>
			<description>I need some help I have managed to get this far (as below), from thatI can put a AAA_NUMBER and be able to get that record details and thats the 1st step that I wanted the 2nd step that I want is say if the DOCID is not available I then need the system to generate a new number (the tricky bit for...</description>
			<content:encoded><![CDATA[<div>I need some help I have managed to get this far (as below), from thatI can put a AAA_NUMBER and be able to get that record details and thats the 1st step that I wanted the 2nd step that I want is say if the DOCID is not available I then need the system to generate a new number (the tricky bit for me now is to have it do the increment since I want the system to 1st look at the current year since each and every year has a different sequence) so the YEAR_SEQUENCE table has CURRENT_YEAR, SEQUENCE, LAST_NUM Fields so it will be incrementing from the last generated number (+1 increment)<br />
<br />
Any suggestions or twicks are welcome!<br />
<br />
 <pre style="margin:20px; line-height:13px">CREATE PROCEDURE Sp_Show_Presc_Num<br />
<br />
@AAA_NUMBER VARCHAR(7) <br />
<br />
AS <br />
<br />
SELECT<br />
&lt;TABLE A&gt;.Surname,<br />
&lt;TABLE A&gt;.Initials,<br />
&lt;TABLE A&gt;.AAA_NUMBER,<br />
&lt;TABLE B&gt;.DOCID,<br />
CONVERT(VARCHAR (10),&lt;TABLE B&gt;.ALLOCATIONDATE,103) AS ALLOCATIONDATE,<br />
&lt;TABLE A&gt;.Sex_Code<br />
FROM &lt;TABLE A&gt;<br />
LEFT JOIN &lt;TABLE B&gt; ON &lt;TABLE B&gt;.BBBNUMBER = &lt;TABLE A&gt;.AAA_NUMBER<br />
WHERE AAA_NUMBER=@AAA_NUMBER</pre><br />
EXECUTION EXAMPLE<br />
---------------------------------------------------------------------USE [TEST DB] <br />
EXEC [Sp_Show_Presc_Num] '4300058'<br />
--------------------------------------------------------------------- <br />
<br />
<span style="font-weight:bold">MORE INFO</span><br />
Some of the them are populated and the DocID should be displayed if available or else if its NULL then there should be an option for the user to have one generated<br />
<br />
The are 3 table<br />
&lt;TABLE A&gt; which will display these fields(Surname, Initials, AAA_NUMBER)<br />
&lt;TABLE B&gt; which will display these fields(DOCID,ALLOCATIONDATE)<br />
&lt;TABLE C&gt; which has these fields (@ the moment)(CURRENT_YEAR, SEQUENCE, LAST_NUM)<br />
<br />
the ALLOCATIONDATE is populated when the DOCID is generated so its on that day</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>wchitamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234691.html</guid>
		</item>
		<item>
			<title>MS SQL: Converting row printing to column based printing</title>
			<link>http://www.daniweb.com/forums/thread234309.html</link>
			<pubDate>Thu, 29 Oct 2009 05:14:58 GMT</pubDate>
			<description><![CDATA[Hi, I am doing a student progression system where the application is able to keep track of student marks. I have a problem currently and I've been spending nights on this.  
 
Let me briefly explain. Marks are calculated based on their hurdles. So for instance, H1 = xx%, H2 = xx%. The number of...]]></description>
			<content:encoded><![CDATA[<div>Hi, I am doing a student progression system where the application is able to keep track of student marks. I have a problem currently and I've been spending nights on this. <br />
<br />
Let me briefly explain. Marks are calculated based on their hurdles. So for instance, H1 = xx%, H2 = xx%. The number of hurdles vary for different subjects. The code below is able to provide me the calculated marks based on each individual's hurdles in rows. However, I'm trying to output it in a horizontal format. Meaning:<br />
<br />
Instead of:<br />
<br />
xx%<br />
xx%<br />
<br />
I want it to be: xx% xx% (in two columns)<br />
<br />
I've tried using the CASE clause in my SELECT section but that only works if the hurdles are static and fixed. My problem is the hurdles are dynamic as well. Is there anyone who has some idea on how to workaround this issue? Thanks in advance guys!! :)<br />
<br />
 <pre style="margin:20px; line-height:13px">SELECT&nbsp; &nbsp;  SUM(Marks.marks_value) * Hurdle.hurdle_weight / 100 AS total<br />
FROM&nbsp; &nbsp; &nbsp; &nbsp;  Marks INNER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Student ON Marks.student_id = Student.student_id INNER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class ON Student.student_id = Class.student_id INNER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MarkingCriteria ON Marks.criteria_id = MarkingCriteria.criteria_id INNER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AssessmentComponent ON MarkingCriteria.component_id = AssessmentComponent.component_id INNER JOIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hurdle ON AssessmentComponent.hurdle_id = Hurdle.hurdle_id<br />
GROUP BY Hurdle.hurdle_id, Hurdle.hurdle_weight, Student.student_id, Class.student_id<br />
ORDER BY Hurdle.hurdle_id</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>dfs3000my</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234309.html</guid>
		</item>
		<item>
			<title>Cute: I need to remove the db_backupoperator permissions from the db_owner role.</title>
			<link>http://www.daniweb.com/forums/thread234206.html</link>
			<pubDate>Wed, 28 Oct 2009 22:13:50 GMT</pubDate>
			<description><![CDATA[The reason is that : 
 
1. I wish to run multiple databases on a single server. 
To do this securely each login must be granted db_owner on the database so we can use "deny view any database" to hide the other databases from view. (login can see all databases they are owner of however). 
 
2. This...]]></description>
			<content:encoded><![CDATA[<div>The reason is that :<br />
<br />
1. I wish to run multiple databases on a single server.<br />
To do this securely each login must be granted db_owner on the database so we can use &quot;deny view any database&quot; to hide the other databases from view. (login can see all databases they are owner of however).<br />
<br />
2. This creates a problem. We do not wish the users to be able to create backups even though they are db_owners.<br />
It's here that I am having difficulties. <br />
<br />
Any ideas?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>BratNZ</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234206.html</guid>
		</item>
		<item>
			<title>View Help</title>
			<link>http://www.daniweb.com/forums/thread234162.html</link>
			<pubDate>Wed, 28 Oct 2009 18:39:24 GMT</pubDate>
			<description><![CDATA[In the view below, I need the line "isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%'), 0)) packed_qty, " to include a "or 'S%'", so that both P and S are found, but I get a syntax error when I add it. 
What is the correct syntax that I am...]]></description>
			<content:encoded><![CDATA[<div>In the view below, I need the line &quot;<span style="color:Red">isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%'), 0)) packed_qty,</span> &quot; to include a &quot;<span style="color:red">or 'S%</span>'&quot;, so that both P and S are found, but I get a syntax error when I add it.<br />
What is the correct syntax that I am missing?<br />
This is what I used <span style="color:Green">isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%' or 'S%'), 0)) packed_qty, </span> and got the syntax at 'or' error.<br />
Below is the whole &quot;Current&quot; view.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">CREATE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view [dbo].[SII_vwYardsOnHandDueRpt]<br />
as<br />
SELECT&nbsp; isnull(wwr.greige_item, (select top 1 item from item where family_code = 'GREIGE' and coi.item like item.item + '%')) greige_item, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.greige_yds, 0) greige_yds, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.finished_item, (select top 1 item from item where family_code = 'FINISHED' and coi.item like item.item + '%')) finished_item, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.finished_yds, 0) finished_yds, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.packed_item, coi.item) packed_item, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.packed_desc, it.description) packed_desc, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%'), 0)) packed_qty, <br />
&nbsp; &nbsp; &nbsp; &nbsp; isnull(wwr.pack_uom, it.u_m) pack_uom, <br />
&nbsp; &nbsp; &nbsp; &nbsp; coi.co_num, <br />
&nbsp; &nbsp; &nbsp; &nbsp; coi.co_line, <br />
&nbsp; &nbsp; &nbsp; &nbsp; coi.co_release, <br />
&nbsp; &nbsp; &nbsp; &nbsp; coi.due_date, <br />
&nbsp; &nbsp; &nbsp; &nbsp; (coi.qty_ordered - coi.qty_shipped) * dbo.SIIItemSalesUOM2(coi.co_num, coi.co_line, coi.co_release) qty_due, <br />
&nbsp; &nbsp; &nbsp; &nbsp; coi.u_m sales_uom, <br />
&nbsp; &nbsp; &nbsp; &nbsp; ca.[name] customer_name,<br />
&nbsp; &nbsp; &nbsp; &nbsp; dbo._SIIQtyDueInYards(coi.co_num, coi.co_line, coi.co_release) qty_due_yds<br />
FROM&nbsp; &nbsp; coitem coi WITH(NOLOCK)<br />
INNER JOIN item it WITH(NOLOCK)<br />
ON&nbsp; &nbsp; &nbsp; it.item = coi.item <br />
LEFT OUTER JOIN co WITH(NOLOCK)<br />
ON&nbsp; &nbsp; &nbsp; co.co_num = coi.co_num <br />
LEFT OUTER JOIN custaddr ca WITH(NOLOCK)<br />
ON&nbsp; &nbsp; &nbsp; ca.cust_num = co.cust_num <br />
&nbsp; &nbsp; AND ca.cust_seq = co.cust_seq <br />
LEFT OUTER JOIN SII_vwWipWebReport wwr <br />
ON&nbsp; &nbsp; &nbsp; wwr.packed_item = coi.item <br />
WHERE&nbsp;  co.stat&nbsp; in ('O', 'S') <br />
&nbsp; &nbsp; AND coi.stat in ('O', 'S')</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Moordoom</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234162.html</guid>
		</item>
		<item>
			<title>SSIS Permission Problem</title>
			<link>http://www.daniweb.com/forums/thread234084.html</link>
			<pubDate>Wed, 28 Oct 2009 08:08:35 GMT</pubDate>
			<description>Good Day All 
 
I have a Package created and hosted in a Machine(Theresa) that has SQL 2008 and i have my Development Machine(Vuyiswa) that has IIS and am Debugging from the my machine. i have a ASP.NET 2.0 App and am executing a Package that in another machine. The First thing i did was to share a...</description>
			<content:encoded><![CDATA[<div>Good Day All<br />
<br />
I have a Package created and hosted in a Machine(Theresa) that has SQL 2008 and i have my Development Machine(Vuyiswa) that has IIS and am Debugging from the my machine. i have a ASP.NET 2.0 App and am executing a Package that in another machine. The First thing i did was to share a directory where the Packages are stored when i install the packages and supplied &quot;Everyone&quot;,&quot;ASP.NET&quot;,&quot;Vuyiswa&quot; Accounts permissions to to access this share. i can go into the share from the another machine without any problem. i have a code like this in my ASP.NET App<br />
<br />
 <pre style="margin:20px; line-height:13px"> try<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Start the SSIS Here<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Application app = new Application();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Package package = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; package = app.LoadPackage(@&quot;D:\Program Files\Microsoft SQL Server\100\DTS\Packages\OMEGA\OMEGA.dtsx&quot;, null);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //@&quot;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Packages\OMEGA\OMEGA.dtsx&quot;, null);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Variables vars = package.Variables;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vars[&quot;Time1&quot;].Value = time;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vars[&quot;Time2&quot;].Value = time;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vars[&quot;Time3&quot;].Value = time;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vars[&quot;TTBLTYPE&quot;].Value = THREAD_DATA[1].ToString();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //package.Connections[&quot;SQLNCLI10.1&quot;].ConnectionString = obj.GetConnectionString(THREAD_DATA[0].ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Excute Package<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Package Execution results: {0}&quot;, local_DtsError.Description.ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch (DtsException ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Exception = ex.Message;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
This execute Fine until the<br />
<br />
 <pre style="margin:20px; line-height:13px"> Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();</pre><br />
it does not stop here , but i trap it here<br />
<br />
 <pre style="margin:20px; line-height:13px"> if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)</pre>            <br />
<br />
<br />
 and the Error am Getting is<br />
<br />
<span style="font-weight:bold">&quot;SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D.\r\nAn OLE DB record is available.  Source:\&quot;Microsoft SQL Server Native Client 10.0&quot;  Hresult: 0x80040E4D  Description:  &quot;Login failed for user 'sa'</span><br />
<br />
On my Package i use the &quot;sa&quot; credentials and my Protection Level is &quot;Dont Save Sensative&quot;<br />
<br />
Thank you<br />
<br />
<br />
Vuyiswa Maseko</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234084.html</guid>
		</item>
		<item>
			<title>creating headr name dynamically</title>
			<link>http://www.daniweb.com/forums/thread234358.html</link>
			<pubDate>Wed, 28 Oct 2009 06:09:25 GMT</pubDate>
			<description>I created 2 tables 
  
 1  st table as csat 
csat_code        csat_ou_cod   csat_csaeid cus name 
CSA00001	ADM00001	6825	CUS08349 
CSA00002	ADM00001	6826	CUS08347 
CSA00003	ADM00001	6832	CUS08351 
CSA02547	ADM00001	6824	CUS04150</description>
			<content:encoded><![CDATA[<div>I created 2 tables<br />
 <br />
 1  st table as csat<br />
csat_code        csat_ou_cod   csat_csaeid cus name<br />
CSA00001	ADM00001	6825	CUS08349<br />
CSA00002	ADM00001	6826	CUS08347<br />
CSA00003	ADM00001	6832	CUS08351<br />
CSA02547	ADM00001	6824	CUS04150<br />
<br />
<br />
 table2 as csat_survey<br />
<br />
surveycode csat_code         qns id   ans id<br />
SUR00001	CSA02547	1	   3<br />
SUR00002	CSA02547	4	   7<br />
<br />
<br />
now i want the resut is<br />
<br />
<br />
csat_code   csat_case_id      qns id(column name)<br />
<br />
<br />
like  the row field of qns id ( table2) is cloumn for my solution table. and the number of qns also varied .so i have to create the dynamic header.. plz any one help me? how can i get this solution?<br />
<br />
<br />
Thanks in advance<br />
<br />
   Sangita.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>shangita</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234358.html</guid>
		</item>
		<item>
			<title>Smart Searches</title>
			<link>http://www.daniweb.com/forums/thread234052.html</link>
			<pubDate>Wed, 28 Oct 2009 05:46:58 GMT</pubDate>
			<description><![CDATA[Simply put, I need a better query. I have a table that contains 85000 rows, each row has a TITLE and an ABSTRACT (they are academic papers). 
 
What I need is to do a realistic SMART search in my query. 
Right now I'm doing  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Simply put, I need a better query. I have a table that contains 85000 rows, each row has a TITLE and an ABSTRACT (they are academic papers).<br />
<br />
What I need is to do a realistic SMART search in my query.<br />
Right now I'm doing <pre style="margin:20px; line-height:13px">SELECT * FROM PsPapers WHERE Title LIKE '%MySearchString%'</pre> which is, as you can see, a fairly retarded search system. This has several problems:<ol style="list-style-type: decimal"><li>If the search is &quot;othello essays&quot; then my query only gives you ones where the title contains &quot;othello essays&quot; even though something like &quot;essays on othello&quot; I would also want to be returned because the title is OBVIOUSLY on point.</li>
<li>My query doesn't use the abstracts right now, the reason is that the abstracts contain alot of crap and should be WEIGHTED MUCH LESS than titles. I would want title matches to list HIGHER than abstract matches.</li>
<li>There is no real cleverness or weighting here. The older cgi system I'm trying to replace uses code taken from an actual search engine so I need to at least ATTEMPT to do a smart search.</li>
</ol><br />
Any thoughts on a better query?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mmxbass</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234052.html</guid>
		</item>
		<item>
			<title>Connection Strings to network.</title>
			<link>http://www.daniweb.com/forums/thread234019.html</link>
			<pubDate>Wed, 28 Oct 2009 02:49:18 GMT</pubDate>
			<description><![CDATA[it seem my connection string doesnt work? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a>...]]></description>
			<content:encoded><![CDATA[<div>it seem my connection string doesnt work?<br />
<br />
 <pre style="margin:20px; line-height:13px">$connect = mssql_connect(&quot;192.170.10.798&quot;,&quot;sa&quot;,&quot;gasd&quot;) or die(mssql_error());<br />
$test = mssql_select_db(&quot;banex&quot;, $connect) or die (mssql_error());</pre><br />
whats wrong with my connection string?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>nanat07</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234019.html</guid>
		</item>
		<item>
			<title>sql convert vertical to horizontal</title>
			<link>http://www.daniweb.com/forums/thread233907.html</link>
			<pubDate>Tue, 27 Oct 2009 15:55:40 GMT</pubDate>
			<description>I am using SQL Server 2005. I have a data from SQL like this. 
 
ID        ID2      PartNo 
 
75        23921  DENT  
75        26145  PLGD  
75        26145  PRRP  
75        26145  SIST  
75        57290  PRMD 
75        57290  abc</description>
			<content:encoded><![CDATA[<div>I am using SQL Server 2005. I have a data from SQL like this.<br />
<br />
ID        ID2      PartNo<br />
<br />
75        23921  DENT <br />
75        26145  PLGD <br />
75        26145  PRRP <br />
75        26145  SIST <br />
75        57290  PRMD<br />
75        57290  abc<br />
75        57290  def<br />
75        57290  ghi<br />
75        57290  jkl<br />
<br />
<br />
I need an output like this. (max Part4)<br />
<br />
ID        ID2    Part1      Part2  Part3  Part4<br />
<br />
75        23921   DENT<br />
75        26145   PLGD   PRRP   SIST<br />
75        57290   PRMD  abc       def       ghi<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>azamsalam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233907.html</guid>
		</item>
		<item>
			<title><![CDATA[How to Create database in SQL Server using Javascript & HTML?]]></title>
			<link>http://www.daniweb.com/forums/thread233881.html</link>
			<pubDate>Tue, 27 Oct 2009 14:16:48 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I want to create database on SQL Server using Javascript and HTML. User will input following data. Server Name, Database name, File Sizes. When I will click "Submit" button database should be created on Selected server with entered name. I am using Client side HTML and Javascript.  
we...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I want to create database on SQL Server using Javascript and HTML. User will input following data. Server Name, Database name, File Sizes. When I will click &quot;Submit&quot; button database should be created on Selected server with entered name. I am using Client side HTML and Javascript. <br />
we need to create database according to some standards thus we are preparing graphical user interface.<br />
Quick response will be appreciated.<br />
<br />
Thanks, Rahul</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Rahul002</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233881.html</guid>
		</item>
		<item>
			<title>Getting sum of cost from one table where quantity on another table</title>
			<link>http://www.daniweb.com/forums/thread233667.html</link>
			<pubDate>Tue, 27 Oct 2009 03:03:02 GMT</pubDate>
			<description><![CDATA[hi guys, I have 2 tables, one called neworders which stores the part_id and num or parts and a 2nd table called parts which has all the part details including cost. 
tables are as follows 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>hi guys, I have 2 tables, one called neworders which stores the part_id and num or parts and a 2nd table called parts which has all the part details including cost.<br />
tables are as follows<br />
 <pre style="margin:20px; line-height:13px">neworder <br />
part_id(primary key)<br />
number_of_parts<br />
<br />
parts<br />
part_id(primary key)<br />
7-8 more columns, eg size, desc, sup id<br />
cost</pre><br />
what i need to do is get the sum of the costs based on the quantity of the parts ordered<br />
<br />
so if table is as follows<br />
<br />
 <pre style="margin:20px; line-height:13px">table new order<br />
part_id number_of_parts<br />
pt12&nbsp; &nbsp;  2<br />
pt255&nbsp;  4</pre><br />
I need to use the part_id of the neworder table to get the costs of the parts and then add them up with sum based on number of parts ordered.<br />
<br />
I have no idea how to do this, any help would be awesome</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mr_scooby</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233667.html</guid>
		</item>
		<item>
			<title>Sql Query</title>
			<link>http://www.daniweb.com/forums/thread233609.html</link>
			<pubDate>Mon, 26 Oct 2009 21:23:01 GMT</pubDate>
			<description><![CDATA[Hello, 
Ihope to find some help in here, i have the following diagram  
 
[IMG]http://img143.imageshack.us/img143/6704/13503390.th.jpg[/IMG] (http://img143.imageshack.us/i/13503390.jpg/) 
 
and i want a query which return Emp_ID, Pro_ID  
 
note; 
i can get these values but by 2 queries as the...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
Ihope to find some help in here, i have the following diagram <br />
<br />
<a rel="nofollow" class="t" href="http://img143.imageshack.us/i/13503390.jpg/" target="_blank"><a href="http://img143.imageshack.us/img143/6704/13503390.th.jpg" target="_blank">http://img143.imageshack.us/img143/6704/13503390.th.jpg</a></a><br />
<br />
and i want a query which return Emp_ID, Pro_ID <br />
<br />
note;<br />
i can get these values but by 2 queries as the following;<br />
 <pre style="margin:20px; line-height:13px">select Pro_ID from Projects where Dep_ID in <br />
(select Dep_ID from Departments where name = 'test') <br />
<br />
select Emp_ID from Employees where Dep_ID in <br />
<br />
(select Dep_ID from Departments where name = 'test')</pre><br />
the goal of having the result through one query is that i want to insert the value into another table<br />
insert into testTable (query)<br />
<br />
Hope to see reply ASAP</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Moody1</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233609.html</guid>
		</item>
		<item>
			<title>MS SQL</title>
			<link>http://www.daniweb.com/forums/thread233599.html</link>
			<pubDate>Mon, 26 Oct 2009 20:59:22 GMT</pubDate>
			<description>Can I get a template for Log in icon. I have purchased DB Name, MS SQL , Database connection. But I dont know how to connect my database file to server. 
BC PATTANAYAK</description>
			<content:encoded><![CDATA[<div>Can I get a template for Log in icon. I have purchased DB Name, MS SQL , Database connection. But I dont know how to connect my database file to server.<br />
BC PATTANAYAK</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>bcpattanayak</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233599.html</guid>
		</item>
		<item>
			<title>Loop to generate future dates?!</title>
			<link>http://www.daniweb.com/forums/thread233515.html</link>
			<pubDate>Mon, 26 Oct 2009 16:23:29 GMT</pubDate>
			<description><![CDATA[What is the best way to generate a set of dates based on today's date? Essentially, what I wanna do is: 
1. Get Current Date 
2. Populate a table with future dates 6 months apart and go up until I reach, let's say, 12/31/2020 
 
I have looked at some of the date functions offered by MS-SQL 2005,...]]></description>
			<content:encoded><![CDATA[<div>What is the best way to generate a set of dates based on today's date? Essentially, what I wanna do is:<br />
1. Get Current Date<br />
2. Populate a table with future dates 6 months apart and go up until I reach, let's say, 12/31/2020<br />
<br />
I have looked at some of the date functions offered by MS-SQL 2005, but not quite sure how to run a loop. (I use ColdFusion as the front-end)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>cheapterp</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233515.html</guid>
		</item>
		<item>
			<title>how can i find the table names</title>
			<link>http://www.daniweb.com/forums/thread233767.html</link>
			<pubDate>Mon, 26 Oct 2009 09:49:22 GMT</pubDate>
			<description>how can i find the table names from Sql server. what r the statement.</description>
			<content:encoded><![CDATA[<div>how can i find the table names from Sql server. what r the statement.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>else_harpal</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233767.html</guid>
		</item>
		<item>
			<title>Importing xml into sql server 2008</title>
			<link>http://www.daniweb.com/forums/thread232967.html</link>
			<pubDate>Sat, 24 Oct 2009 17:32:59 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I need a little help importing an XML file into sqlserver 2008.  I followed this example 
 
http://www.sql-server-performance.com/articles/dba/Loading_XML_data_into_SQL_Server_2008_p1.aspx 
 
(make sure you goto the rest of the pages in the article!) , generated the schema etc., but I can't...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I need a little help importing an XML file into sqlserver 2008.  I followed this example<br />
<br />
<a rel="nofollow" class="t" href="http://www.sql-server-performance.com/articles/dba/Loading_XML_data_into_SQL_Server_2008_p1.aspx" target="_blank">http://www.sql-server-performance.co...r_2008_p1.aspx</a><br />
<br />
(make sure you goto the rest of the pages in the article!) , generated the schema etc., but I can't get the import <br />
<br />
to do what I need. I was able to add the DataConversion on my own but I can't seem to figure out how to get both ID <br />
<br />
fields in the middle table.<br />
I made a simplified version.  For this example I have 3 tables.  Books, BookAuthors, Authors.<br />
<br />
Books Table (bookID, bookTitle, bookNumPages)<br />
BookAuthors Table (bookID, authorID)<br />
Authors (authorID, authorName)<br />
<br />
After the Import the tables should look like this<br />
Books<br />
79, Some Good Book, 300<br />
112, Another Book, 350<br />
BookAuthors<br />
79, 200<br />
79, 205<br />
79, 215<br />
112, 200<br />
Authors<br />
200, First Author<br />
205, Second Author<br />
215, Third Author<br />
<br />
The Problem I'm having is getting the BookID and AuthorID into the BookAuthors Table.  I'm just wondering if there <br />
<br />
is an easy way to set this up to Import or if I'm going to have to code it line by line.<br />
<br />
 <pre style="margin:20px; line-height:13px">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />
&lt;result&gt;<br />
&nbsp; &nbsp; &lt;books&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;book&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bookID&gt;79&lt;/bookID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bookTitle&gt;Some Good Book&lt;/bookTitle&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bookNumPages&gt;300&lt;/bookNumPages&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authors&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;200&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;205&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;215&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/authors&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/book&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;book&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bookID&gt;112&lt;/bookID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bookTitle&gt;Another Book&lt;/bookTitle&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bookNumPages&gt;350&lt;/bookNumPages&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authors&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;200&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/authors&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/book&gt;<br />
&nbsp; &nbsp; &lt;/books&gt;<br />
&nbsp; &nbsp; &lt;authors&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;200&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorName&gt;First Author&lt;/authorName&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;205&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorName&gt;Second Author&lt;/authorName&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;author&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorID&gt;215&lt;/authorID&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;authorName&gt;Third Author&lt;/authorName&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/author&gt;<br />
&nbsp; &nbsp; &lt;/authors&gt;<br />
&lt;/result&gt;</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>dvprez</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232967.html</guid>
		</item>
		<item>
			<title>sql +sql reporting service</title>
			<link>http://www.daniweb.com/forums/thread232376.html</link>
			<pubDate>Thu, 22 Oct 2009 17:35:12 GMT</pubDate>
			<description><![CDATA[Hi  
 
I developed report using sql server reporting service.I used parameter to assign value for sql query.I  want to use "LIKE" keyword in using parameter,How i do that?i wrote coding  below what u wrote before.I used @con as parameter. 
 
Select FriutID from Friut where friutName like'@con'%. ...]]></description>
			<content:encoded><![CDATA[<div>Hi <br />
<br />
I developed report using sql server reporting service.I used parameter to assign value for sql query.I  want to use &quot;LIKE&quot; keyword in using parameter,How i do that?i wrote coding  below what u wrote before.I used @con as parameter.<br />
<br />
 <pre style="margin:20px; line-height:13px">Select FriutID from Friut where friutName like'@con'%.</pre> <br />
Once I write above coding it gave me syntax error message.<br />
<br />
Thank<br />
Tank50</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Tank50</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232376.html</guid>
		</item>
		<item>
			<title>best wait to transpose all elements of a column into ColumnFields</title>
			<link>http://www.daniweb.com/forums/thread232337.html</link>
			<pubDate>Thu, 22 Oct 2009 15:44:10 GMT</pubDate>
			<description>Hello, 
 
I would like to know if there is an easy way to transform the following table 
 
			      CarId   | PropertyName    |  PropertyValue 
				   1      |   Size          |   XL   
				   1      |   Name          |   Porsche   
				   1      |   Color         |   Red   
				   2      |   Size ...</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I would like to know if there is an easy way to transform the following table<br />
<br />
			      CarId   | PropertyName    |  PropertyValue<br />
				   1      |   Size          |   XL  <br />
				   1      |   Name          |   Porsche  <br />
				   1      |   Color         |   Red  <br />
				   2      |   Size          |   XS  <br />
				   2      |   Name          |   Smart  <br />
				   3      |   Name          |   Audi<br />
<br />
<br />
<br />
into <br />
<br />
			      CarId   |   Size  |     Name   |   Color<br />
				   1      |   XL    |   Porsche  |    Red<br />
				   2      |   XS    |   Smart    |				 <br />
				   3      |         |   Audi     |<br />
<br />
with MSSQL 2005 (i am using Studio Express)<br />
<br />
This a kind of crossTabling.<br />
<br />
until now here is what i am doing:<br />
<br />
I create a table why just 1 empty column (CarId)<br />
<br />
For each CarId, <br />
	I put the cardId in CarId Column<br />
	For each couple (PropertyName,PropertyValue)<br />
		i test whether the column 'PropertyName' exists. If no, i create it<br />
		then i put the 'PropertyValue' in the box (x='CardId',y='PropertyName')<br />
		<br />
		<br />
Thank you<br />
		<br />
		<br />
Julien</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Julamotte</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232337.html</guid>
		</item>
		<item>
			<title>Connection to remote server</title>
			<link>http://www.daniweb.com/forums/thread232266.html</link>
			<pubDate>Thu, 22 Oct 2009 10:43:28 GMT</pubDate>
			<description>I have multiple external databases that i want to connect to, from a stored procedure. What server the database is located on is dynamic (a record in a table). All of the external databases are LinkedServers, but also here i need to be able to define what server dynamicly. 
 
It works when i use...</description>
			<content:encoded><![CDATA[<div>I have multiple external databases that i want to connect to, from a stored procedure. What server the database is located on is dynamic (a record in a table). All of the external databases are LinkedServers, but also here i need to be able to define what server dynamicly.<br />
<br />
It works when i use EXEC to connect to the remote servers, example:<br />
 <pre style="margin:20px; line-height:13px">DECLARE @SQLinkedTable AS VARCHAR(50)<br />
DECLARE @SQL NVARCHAR(4000)<br />
DECLARE @Quantity AS INT<br />
<br />
SET @SQLinkedTable='LINKEDSERVER1.DB1.dbo'<br />
SELECT @SQL = 'SELECT @Quantity=COUNT(*) FROM '+@SQLinkedTable+'.[CampaignSettings] WHERE SQLID=1'<br />
EXEC sp_executesql @SQL, N'@Quantity INT OUTPUT', @Quantity OUTPUT</pre><br />
In this code it returns a count to me from the external database, but i whould like to to more than that, for example UPDATES from the current database, and i think making a cursor to loop all the records is a bit messy.<br />
<br />
These don't work: <br />
 <pre style="margin:20px; line-height:13px">DECLARE @SQLinkedTable AS VARCHAR(50)<br />
<br />
SET @SQLinkedTable='LINKEDSERVER1.DB1.dbo'<br />
SELECT * FROM @SQLinkedTable.[CampaignSettings])<br />
<br />
DECLARE @ExternalDB AS VARCHAR(200)<br />
SET @ExternalDB = 'Server=111.111.111.111;Database=DB1;UID=USR;Pwd=PASS;'<br />
SELECT * FROM OPENROWSET ('SQLNCLI',@ExternalDB, 'SELECT * FROM [CampaignSettings]')</pre><br />
I know that everyone says don't do dynamic table linking, but in this case i have no option.<br />
<br />
Any other Ideas?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>NextCom</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232266.html</guid>
		</item>
		<item>
			<title>Best way to backup a database from one server to another server in SQL Server 2005</title>
			<link>http://www.daniweb.com/forums/thread231669.html</link>
			<pubDate>Tue, 20 Oct 2009 14:02:00 GMT</pubDate>
			<description>I need to know how and what steps to automate to backup a database on my production SQL server and restore that database in my test SQL server. The database exists in both servers currently. I want to set this up so it will run every day at a certain time. Does anyone know what I need to do for...</description>
			<content:encoded><![CDATA[<div>I need to know how and what steps to automate to backup a database on my production SQL server and restore that database in my test SQL server. The database exists in both servers currently. I want to set this up so it will run every day at a certain time. Does anyone know what I need to do for this.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mldardy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread231669.html</guid>
		</item>
		<item>
			<title><![CDATA[Select only items that don't exist in another table]]></title>
			<link>http://www.daniweb.com/forums/thread231439.html</link>
			<pubDate>Mon, 19 Oct 2009 16:57:00 GMT</pubDate>
			<description><![CDATA[I want to select from a table only when a field repeats more than once.  For this I have: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with...]]></description>
			<content:encoded><![CDATA[<div>I want to select from a table only when a field repeats more than once.  For this I have:<br />
<br />
 <pre style="margin:20px; line-height:13px">Select title, Count(*) As Cnt From poss_titles where Cnt &gt; 1 Group By Title Order By Cnt desc</pre><br />
But it says invalid column name cnt.  How should I refer to this dynamic field?<br />
Also, I only really want titles which dont exist in another table.  I believe a left join is required for this but I'm not too sure how to do it.<br />
Can anyone offer me some pointers?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>benkyma</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread231439.html</guid>
		</item>
		<item>
			<title>SELECT statement</title>
			<link>http://www.daniweb.com/forums/thread230835.html</link>
			<pubDate>Fri, 16 Oct 2009 23:40:20 GMT</pubDate>
			<description><![CDATA[I have a table for example: tb1 
with data: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a>...]]></description>
			<content:encoded><![CDATA[<div>I have a table for example: tb1<br />
with data:<br />
 <pre style="margin:20px; line-height:13px">cse-12m<br />
cse-343k<br />
cse-mka<br />
cse-ptu<br />
cse-jpy</pre><br />
How can I write a SELECT statement to retrieve data in one of these formats:<br />
1) cse-three digits number<br />
2) cse-p%<br />
<br />
and exclude other format data, any idea?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>michael123</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230835.html</guid>
		</item>
		<item>
			<title>Need help on data addition</title>
			<link>http://www.daniweb.com/forums/thread230821.html</link>
			<pubDate>Fri, 16 Oct 2009 21:56:05 GMT</pubDate>
			<description><![CDATA[Hi,,.. Need hlpe on this. 
 
I have 2 columns Oldvalue and newvalue. I want to create a store procedure where the query will be as if oldvalue and new value have record, but both the records are not same then 'change' variable should increment by 1 for each computername, again if oldvalue is having...]]></description>
			<content:encoded><![CDATA[<div>Hi,,.. Need hlpe on this.<br />
<br />
I have 2 columns Oldvalue and newvalue. I want to create a store procedure where the query will be as if oldvalue and new value have record, but both the records are not same then 'change' variable should increment by 1 for each computername, again if oldvalue is having nullvalue and newvalue has record then 'add' variable should increment by 1 for each computername, same if oldvalue has record and newvalue has no record then 'remove' variable should increment by 1 for each computername. Also want to calculate the grantotal as shown below:<br />
<br />
example:<br />
<br />
name     add     change    remove    grand total<br />
abc          1           1             0                2  <br />
pqr          0           2             1                3  <br />
sdf          2            1             1               4     <br />
<br />
This was my first query<br />
My second query is I want to count the 'add' and 'remove' column as shown below from the above data only:<br />
<br />
add                         3<br />
remove                   2<br />
<br />
Kindly help me out to get out of this problem</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Abhishek_Boga</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230821.html</guid>
		</item>
		<item>
			<title>Small MSSQL problem</title>
			<link>http://www.daniweb.com/forums/thread230674.html</link>
			<pubDate>Fri, 16 Oct 2009 11:13:48 GMT</pubDate>
			<description><![CDATA[I'm using this piece of code to get the number of search results. However it says- Incorrect syntax near ')' (the very last ')'  ) 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I'm using this piece of code to get the number of search results. However it says- Incorrect syntax near ')' (the very last ')'  )<br />
 <pre style="margin:20px; line-height:13px">SELECT COUNT(*) FROM<br />
(SELECT&nbsp; ID, ProductDescription FROM Products WHERE ProductDescription LIKE '%tech%')</pre>The inner select works fine and gives correct results, so I don't understand what's the problem... I won't be surprised if it's something stupid, but I've tried lots of things but with no success..<br />
So I hope you guys can give some hints.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Wiizl</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230674.html</guid>
		</item>
		<item>
			<title>mysql to mssql</title>
			<link>http://www.daniweb.com/forums/thread230610.html</link>
			<pubDate>Fri, 16 Oct 2009 05:48:18 GMT</pubDate>
			<description><![CDATA[hi, 
can any one tell me how to i use my sql sever's databse itno ms sql 2008 server. 
I tried to to do dat with the help of mysql backup file & execute it on ms sql server, but there are some syntax related problems. 
please help me. 
thanks in advance]]></description>
			<content:encoded><![CDATA[<div>hi,<br />
can any one tell me how to i use my sql sever's databse itno ms sql 2008 server.<br />
I tried to to do dat with the help of mysql backup file &amp; execute it on ms sql server, but there are some syntax related problems.<br />
please help me.<br />
thanks in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>kool.net</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230610.html</guid>
		</item>
		<item>
			<title>Convertion of Column name into Rows</title>
			<link>http://www.daniweb.com/forums/thread230384.html</link>
			<pubDate>Thu, 15 Oct 2009 12:23:37 GMT</pubDate>
			<description>I want to display the columns in to rows format as below: 
 
eg: _ col 1 _   _clo 2 _    
        yes      No 
 
I want this to display as: 
 
_Column name_ 
yes  
no</description>
			<content:encoded><![CDATA[<div>I want to display the columns in to rows format as below:<br />
<br />
eg: <span style="text-decoration:underline"> col 1 </span>   <span style="text-decoration:underline">clo 2 </span>   <br />
        yes      No<br />
<br />
I want this to display as:<br />
<br />
<span style="text-decoration:underline">Column name</span><br />
yes <br />
no <br />
<br />
The Code which i used as below:<br />
<br />
 <pre style="margin:20px; line-height:13px">set ANSI_NULLS ON<br />
set QUOTED_IDENTIFIER ON<br />
GO<br />
<br />
create PROCEDURE &#91;dbo&#93;.&#91;Vista_Capable&#93;&nbsp; &nbsp; &nbsp; &nbsp; <br />
AS&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
SET NOCOUNT ON;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
BEGIN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Select 'Yes','No'<br />
End</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>Abhishek_Boga</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230384.html</guid>
		</item>
		<item>
			<title>SQL Query is taking too much time</title>
			<link>http://www.daniweb.com/forums/thread230381.html</link>
			<pubDate>Thu, 15 Oct 2009 12:02:58 GMT</pubDate>
			<description><![CDATA[Hi,  
 
i have created a sp, that is taking too much time (more than 35 sec, is it more?). 
 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help...]]></description>
			<content:encoded><![CDATA[<div>Hi, <br />
<br />
i have created a sp, that is taking too much time (more than 35 sec, is it more?).<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">SELECT&nbsp; top 11 ROW_NUMBER() OVER (ORDER BY&nbsp; hjs_job_details.date_posted desc, KEY_TBL.RANK&nbsp; desc) <br />
AS Row, job_id,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
(case when len(job_title)&gt;59 then (substring(job_title,0,59)+'...') else job_title end ) as title,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
company_name as Source_Org, source_company_name as Org, jobdescription_url,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp;dbo.job_posted_on(hjs_job_details.date_posted) as date_posted, (short_desc+'...') as description,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
street, city, hjs_state.state_abbr as state, hjs_job_details.zipcode, company_url, hjs_job_details.state as job_state,hjs_job_details.crawledby&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
FROM hjs_job_details left outer join hjs_adv_source_type ha on hjs_job_details.source_type_id=ha.source_type_id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
left outer join&nbsp; hjs_latlong on hjs_job_details.zipcode = hjs_latlong.zipcode&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
left outer join&nbsp; hjs_state on (hjs_job_details.state=hjs_state.state_abbr)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
left outer join&nbsp; hjs_service_campaign on (hjs_job_details.campaign_id = hjs_service_campaign.camp_id)<br />
INNER JOIN <br />
FREETEXTTABLE(hjs_job_details,(Job_title,short_desc,company_name),'nurse')&nbsp; &nbsp; &nbsp; &nbsp;  <br />
as KEY_TBL ON hjs_job_details.job_id = KEY_TBL.[KEY]&nbsp; where ( (1=1) <br />
and (dbo.udfn_Distance(29.6804,-82.3457,latitude,longitude) &lt;= 50 )<br />
and ( ( hjs_job_details.campaign_id is null )<br />
or (hjs_service_campaign.status &lt;&gt; 1) or ( dbo.CheckSponsordJobDailyBudget(job_id)=0)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
and((convert(datetime,convert(nvarchar,expiry_date,101))&gt;=convert(datetime,convert(nvarchar,getdate(),101)) OR expiry_date IS NULL)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
and (hjs_job_details.status=1 or hjs_job_details.status is null))</pre><br />
<br />
the line (dbo.udfn_Distance(29.6804,-82.3457,latitude,longitude) &lt;= 50 ) is taking too much time when we search in 70000 records.it is for finding distance between two lat/longs, i have checked function udfn_Distance, it is working fine.it is only taking time when it takes lat/longs for records.<br />
<br />
actually after calling this sp that 6 more sps are calling , so my page loading gets very slow, it take more than 5 mins to load full page with radius search.<br />
<br />
i want to make it fast.how can i do that.<br />
<br />
Please help me.<br />
<br />
Thanks,<br />
Ashish Pandey</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>ashu2409</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230381.html</guid>
		</item>
		<item>
			<title>Help with the Following Logic</title>
			<link>http://www.daniweb.com/forums/thread230380.html</link>
			<pubDate>Thu, 15 Oct 2009 11:57:51 GMT</pubDate>
			<description><![CDATA[Good Day all  
 
it is Probably a long day, i cant think Straight now.  
 
i have a table that looks like this  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680"...]]></description>
			<content:encoded><![CDATA[<div>Good Day all <br />
<br />
it is Probably a long day, i cant think Straight now. <br />
<br />
i have a table that looks like this <br />
<br />
 <pre style="margin:20px; line-height:13px">Nodeid&nbsp;  Parent&nbsp;  Description&nbsp; &nbsp;  Type&nbsp; &nbsp; &nbsp; Curr<br />
==========================================================================================<br />
89&nbsp; &nbsp; &nbsp; &nbsp;  NULL&nbsp; &nbsp;  Compulsory&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10<br />
90&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 89&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B1052&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10<br />
2820&nbsp; &nbsp; &nbsp; 89&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; One of&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10<br />
<span style="color:red"><br />
4113&nbsp; &nbsp; &nbsp; &nbsp; 89&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B1061&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10</span><br />
2821&nbsp; &nbsp; &nbsp; &nbsp; 2820&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B1054&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10<br />
2822&nbsp; &nbsp; &nbsp; &nbsp; 2820&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B1055&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10</pre><br />
Now the Red Record needs to be on top of &quot;One of&quot; because the Parent is &quot;Compulsary&quot; with the &quot;Parent&quot; = 89. Now Even &quot;One of &quot; has the Same Parent as the red record but if its a &quot;One of &quot; and they have the same parent, then &quot;One of &quot;  must always be below the record. What i mean is that if there is a record with a same parent but different Type , the one that has type 2 should go below the one that has type 3 in my query. here is my query <br />
<br />
 <pre style="margin:20px; line-height:13px">select distinct nP.id, nP.NodeID, nP.parent, nP.Description, nRef.ID refParent, np.type <br />
&nbsp;from #Nodes nP<br />
left outer join #Nodes nRef on nP.Parent = nRef.NodeID&nbsp; &nbsp; &nbsp; &nbsp; -- look up the reference id of the parent<br />
order by&nbsp; refParent,nP.id,np.type desc</pre><br />
Thank you</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>vuyiswamb</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230380.html</guid>
		</item>
		<item>
			<title>Communicating with MSSQL from Linux using PHP?</title>
			<link>http://www.daniweb.com/forums/thread229756.html</link>
			<pubDate>Tue, 13 Oct 2009 08:47:19 GMT</pubDate>
			<description><![CDATA[Hi, 
 
First of all, I'm no database expert. See me as managing a project where this problem occurs.  
 
We are building a system that will enable us to roll out Windows Patches automatically to all Windows systems we manage. We use WSUS on SQL Server 2005/SQL Express. The application will be part...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
First of all, I'm no database expert. See me as managing a project where this problem occurs. <br />
<br />
We are building a system that will enable us to roll out Windows Patches automatically to all Windows systems we manage. We use WSUS on SQL Server 2005/SQL Express. The application will be part of  our system monitoring tool, which in its turn runs on Linux using PHP Apache. <br />
<br />
The problem is we cannot communicate with SQL Server/WSUS using PHP from the Linux system. They can connect using telnet to the port. PHP however does not work. The developers told me they have searched the Internet, and found countless solutions for this problem. But none of the solutions work for them. So my question is: Has anyone wrestled with this problem, and solved it? <br />
<br />
TIA,<br />
Abel</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>MacAdam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread229756.html</guid>
		</item>
		<item>
			<title>help with SQL query / view / count problem....</title>
			<link>http://www.daniweb.com/forums/thread229656.html</link>
			<pubDate>Tue, 13 Oct 2009 00:02:23 GMT</pubDate>
			<description><![CDATA[Greetings! I am hoping someone can help me with a MS SQL query/view problem. 
 
I am creating a "name my new baby" website where parents can upload a picture of their child and have  
 
users cast votes for a good name.  Users will see the child's photo and they will be able to "agree"  
 
with a...]]></description>
			<content:encoded><![CDATA[<div>Greetings! I am hoping someone can help me with a MS SQL query/view problem.<br />
<br />
I am creating a &quot;name my new baby&quot; website where parents can upload a picture of their child and have <br />
<br />
users cast votes for a good name.  Users will see the child's photo and they will be able to &quot;agree&quot; <br />
<br />
with a current suggested name or post their own suggested name.  I know most parents would rather name <br />
<br />
their own kid..this is just for fun to see what I can accomplish. :)<br />
<br />
So far I have two tables like this:<br />
<br />
Kids:<br />
kidID (int unique primary key)<br />
parentId (int..cross referenced to parents account)<br />
photoFile (varchar 25 characters referencing file photo)<br />
<br />
Votes:<br />
nameId (int unique primary key)<br />
suggestedName (varchar 15 characters)<br />
votescast (int...this counts how many votes each name has)<br />
<br />
What I would like is to have a &quot;masterlist&quot; page that shows a list of all current photos with the <br />
currently top voted name.  So if newborn.jpg has 25 votes for &quot;Sammy&quot; and littlecutie.jpg has 3 votes <br />
<br />
for &quot;Jessica&quot; my query would return the fields &quot;KidId, photoFile, suggestedName, VotesCast&quot; with the <br />
<br />
date being:<br />
<br />
5, redheadnewborn.jpg, &quot;Sammy&quot;, 25<br />
12, littlecutie.jpg, &quot;Jessica&quot;, 3<br />
<br />
I am only interested in seeing the top voted name for each photo.  I have tried a number of queries <br />
<br />
involving views...none of which seem to return what I want.<br />
<br />
I know this will probably involve the sql count function but I can't find an example that is close to what I want.  Any help would be very appreciated.   If it helps I am using MS SQL 2008.<br />
<br />
Thanks,<br />
J</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>jasperjerome</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread229656.html</guid>
		</item>
		<item>
			<title>Problem with keys</title>
			<link>http://www.daniweb.com/forums/thread229226.html</link>
			<pubDate>Sun, 11 Oct 2009 04:27:01 GMT</pubDate>
			<description><![CDATA[Hi, I have 2 tables that I have made using sql create table which seem to work ok until I try to insert data into the 2nd table then it throws a: didn't add 1 record due to key violations. 
 
When I use the design wizard and do exactly the same thing but without using sql it works fine. 
 
table 1...]]></description>
			<content:encoded><![CDATA[<div>Hi, I have 2 tables that I have made using sql create table which seem to work ok until I try to insert data into the 2nd table then it throws a: didn't add 1 record due to key violations.<br />
<br />
When I use the design wizard and do exactly the same thing but without using sql it works fine.<br />
<br />
table 1 sql- user table <br />
 <pre style="margin:20px; line-height:13px">CREATE TABLE User (<br />
userEmailAddress varChar(255) not null PRIMARY KEY, <br />
userFirstName varChar(100) not null,<br />
userLastName varChar(100),<br />
userStatus varChar(1) not null,<br />
userNickName varChar(40),<br />
userMifrenzPassword varChar(10) not null,<br />
UserEmailPassword varChar(10) not null,<br />
userDOB date<br />
)</pre>table 2 sql - email options table <br />
 <pre style="margin:20px; line-height:13px">CREATE TABLE Email_Options (<br />
emailNumber number not null PRIMARY KEY,<br />
userEmailAddress varChar(255) not null, <br />
emailProvider varChar(255) not null,<br />
popServerAddress&nbsp; varChar(255) not null,<br />
smtpServerAddress&nbsp; varChar(255) not null,<br />
popServerPort varChar(6) not null, <br />
smtpServerPort varChar(6) not null,<br />
FOREIGN KEY(userEmailAddress) references user(userEmailAddress)<br />
)</pre>have spent ages trying to find a solution and just don't know enough <br />
<br />
Like I said everything works ok when I do it using the design wizard and creating the relationships manually, however when I use sql I get exactly the same physical layout and view in the view and relationship view, except I get the cannot add record due to key violation.<br />
<br />
I get the message when updating the email options table, updating the user table works fine.<br />
<br />
Any ideas?? I'm lost :(</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mr_scooby</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread229226.html</guid>
		</item>
		<item>
			<title>Count distinct values</title>
			<link>http://www.daniweb.com/forums/thread228839.html</link>
			<pubDate>Fri, 09 Oct 2009 10:50:51 GMT</pubDate>
			<description><![CDATA[I need to query a database of application titles and count the instances of each title.  I've already got a list<string> of distinct values from a previous query, and now I need to count how many times each value occurs.  I'm not sure if the query is correct, or how to handle the output.  So far I...]]></description>
			<content:encoded><![CDATA[<div>I need to query a database of application titles and count the instances of each title.  I've already got a list&lt;string&gt; of distinct values from a previous query, and now I need to count how many times each value occurs.  I'm not sure if the query is correct, or how to handle the output.  So far I have:<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
(cands is my list of distinct titles)<br />
&nbsp;for (int i = 0; i &lt; cands.Count; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SqlCommand appCommand = new SqlCommand(&quot;select count(title) from poss_titles where title = @thisTitle&quot;, appConnection);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appCommand.Parameters.AddWithValue(&quot;@thisTitle&quot;, cands[i]);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SqlDataReader reader = appCommand.ExecuteReader();</pre><br />
I have created an 'AppTitle' class with getters and setters for 'name' and 'instances' so that I can return a List&lt;AppTitle&gt; from this method.  Maybe there is a better way than this?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>benkyma</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228839.html</guid>
		</item>
		<item>
			<title>Stored procedure error</title>
			<link>http://www.daniweb.com/forums/thread228772.html</link>
			<pubDate>Fri, 09 Oct 2009 05:56:50 GMT</pubDate>
			<description><![CDATA[Hi to all , 
I am developing website in asp.net2.0 using VB. 
I wrote sored procedure, 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code...]]></description>
			<content:encoded><![CDATA[<div>Hi to all ,<br />
I am developing website in asp.net2.0 using VB.<br />
I wrote sored procedure,<br />
 <pre style="margin:20px; line-height:13px">ALTER PROCEDURE SELECTSC<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; (<br />
&nbsp; &nbsp; &nbsp; &nbsp; @cid INT<br />
&nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
AS<br />
BEGIN<br />
SELECT sc FROM collage_detail WHERE c_id=@cid<br />
END<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* SET NOCOUNT ON */ <br />
&nbsp; &nbsp; &nbsp; &nbsp; RETURN</pre>and in vb I wrote on button click,<br />
 <pre style="margin:20px; line-height:13px">cmd.CommandType = CommandType.StoredProcedure<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd.CommandText = &quot;SELECTSC&quot;<br />
'ot contains integer value<br />
Dim ot As Integer = op(i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd.Parameters.Add(&quot;@cid&quot;, SqlDbType.Int).Value = ot</pre><br />
while running application it gives me error that Function or procedure SELECTSC too many arguments specified.<br />
<br />
In collage_detail table I want value in sc column as per the c_id(collage id) . I will provide collage Id from array in while loop.<br />
because I want to check for 5 different collages.<br />
<br />
please give me any solution...!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>sakhi kul</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228772.html</guid>
		</item>
		<item>
			<title>Padding Leading Zeroes to auo-increment INT column</title>
			<link>http://www.daniweb.com/forums/thread228645.html</link>
			<pubDate>Thu, 08 Oct 2009 19:32:54 GMT</pubDate>
			<description>I have a table in which I have an auto-increment int ID column. Can I set this column to pad the zeroes at the beginning so as to store them as, say, 0001 instead of 1, 0002 instead of 2, and so on? 
 
Subsequently, when the table reaches 10 entries, the ID should be 0010; on 100, it becomes 0100....</description>
			<content:encoded><![CDATA[<div>I have a table in which I have an auto-increment int ID column. Can I set this column to pad the zeroes at the beginning so as to store them as, say, 0001 instead of 1, 0002 instead of 2, and so on?<br />
<br />
Subsequently, when the table reaches 10 entries, the ID should be 0010; on 100, it becomes 0100. Implying that the number of zeroes to be padded does not always remain 3.<br />
<br />
The reason I wanna do this is because this auto-increment column is not the primary key column. Based on these integers, another column (which is the key) is to be updated such that the character triad of 'MLS' is concatenated to the int IDs like this:<br />
<br />
  ID	      MLSNumber<br />
0001	MLS0001<br />
0002	MLS0002<br />
0003	MLS0003<br />
.	           .<br />
.	           .<br />
.	           .<br />
etc.<br />
<br />
I am trying to setup a trigger for this concatenation process, but was wondering if there is an in-built way in SQL 2005 Express to pad the numbers rather than me having to do it. If not, what's the best way to proceed?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>SQL_n00b</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228645.html</guid>
		</item>
		<item>
			<title>Select same column value and count</title>
			<link>http://www.daniweb.com/forums/thread228517.html</link>
			<pubDate>Thu, 08 Oct 2009 06:27:22 GMT</pubDate>
			<description><![CDATA[Guys,  
I need your help as I really can't seem to start on this query.I seem to not be able to come up with any logic. 
 
I have to create a query for a table. 
I have two tables in my DB . 
First one is a book table which consists of information about a book 
My table looks like following  
 
   ...]]></description>
			<content:encoded><![CDATA[<div>Guys, <br />
I need your help as I really can't seem to start on this query.I seem to not be able to come up with any logic.<br />
<br />
I have to create a query for a table.<br />
I have two tables in my DB .<br />
First one is a book table which consists of information about a book<br />
My table looks like following <br />
<br />
                  Table Book<br />
------------------------------------------------------------<br />
 book_id   | book_title   |  book_author<br />
-------------------------------------------------------------<br />
1              |   Abc             | Xyz<br />
2              |  Def              | Xyz<br />
3              | Ghi                | Xyz<br />
<br />
The other table is the transaction table which is used to issue books to a user<br />
<br />
                  Table Transaction<br />
------------------------------------------------------------<br />
  transaction_id   |   book_id   | transaction_date<br />
-------------------------------------------------------------<br />
   1                        |      2         |  XX-XX-XXXX <br />
   2                        |      1         |  XX-XX-XXXX<br />
   3                        |      1         |  XX-XX-XXXX<br />
   4                        |      3         |  XX-XX-XXXX<br />
   5                        |      2         |  XX-XX-XXXX<br />
   6                        |      2         |  XX-XX-XXXX<br />
   7                        |      1         |  XX-XX-XXXX<br />
   8                        |      2         |  XX-XX-XXXX<br />
<br />
<br />
Now the query which I need to make is to get the results of top issued books which means to display the books which have been issued the most or in other words been transacted the most (along the with the amount of times the book has been transacted).<br />
So that the result look like this <br />
----------------------------------------------------<br />
      Book_id            |   Times_Transacted  <br />
-----------------------------------------------------       <br />
        2                    |   4<br />
        1                    |   3<br />
        3                    |   1<br />
<br />
<br />
I would really appreciate any help on this.<br />
Cheers,<br />
Sushant</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>sushant17284</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228517.html</guid>
		</item>
		<item>
			<title>Inserting multiple rows with 1 sql INSERT using ACCESS</title>
			<link>http://www.daniweb.com/forums/thread228509.html</link>
			<pubDate>Thu, 08 Oct 2009 05:54:33 GMT</pubDate>
			<description><![CDATA[hi guys, done heaps of googling and everything leads me to two outcomes.  
 
1. You can't do it 
 
2. You can do it this way  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680"...]]></description>
			<content:encoded><![CDATA[<div>hi guys, done heaps of googling and everything leads me to two outcomes. <br />
<br />
1. You can't do it<br />
<br />
2. You can do it this way <br />
<br />
 <pre style="margin:20px; line-height:13px">INSERT INTO User(userEmailAddress, userFirstName,userLastName,userStatus,userNickName,userMifrenzPassword,userEmailPassword,userDOB)<br />
<br />
SELECT 'overthehill@gmail.com','Ben','Hill','U','benny','milk','soccer','20-10-2000'<br />
UNION ALL<br />
<br />
SELECT 'smithy@gmail.com','Tony','Smith','A','smithy','bread','rugby','20-11-1976'<br />
UNION ALL<br />
<br />
SELECT 'hotpants@gmail.com','Sarah','Jane','U','hotty','toast','netball','15-1-2000'<br />
UNION ALL<br />
<br />
SELECT 'traci@gmail.com','Traci','Hill','U','raisins','coffee','hockey','20-10-2000'<br />
UNION ALL<br />
<br />
SELECT 'lol@gmail.com','Ben','Johns','U','stubby','jam','rowing','10-2-2001'<br />
UNION ALL<br />
<br />
SELECT 'ss@gmail.com','Sarah','Smith','U','shorty','ham','running','5-5-2000'<br />
UNION ALL<br />
<br />
SELECT 'bob@gmail.com','Bob','Cawte','A','bob','eggs','bobsled','29-3-1980'</pre><br />
except it throws a  <br />
<br />
 <pre style="margin:20px; line-height:13px">Syntax error(misisng operator) in query expression &quot;20-10-2000&quot;<br />
UNION ALL<br />
<br />
SELECT 'smithy@gmail.com&quot;.</pre><br />
worst comes to worst I can use individual INSERT commands to demonstrate my database in class, but I have 40+ records for 2 tables so was trying to find a quicker way of doing it in two statements instead of 80.<br />
<br />
Anyone know if you can do this?<br />
<br />
cheers</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum127.html">MS SQL</category>
			<dc:creator>mr_scooby</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228509.html</guid>
		</item>
	</channel>
</rss>
