Real Newbie Post...

Sep 1, 2006

I was hoping there would be a newbie section in here... But I'll post anyway (And sorry in advance if its a really dumb question)
I am using VWDE and have a SQL DB which has been imported from one of my existing forums, when it shows in the database explorer its show like below
tblArcade (jdName)
tblArcadePB (jdName)
etc..etc...
What I want to know is why this DB has (jdName) after the Table name and my other DB's shown don't?? They are just shown as

tblArcade

tblArcadePB
etc..etc..
 My main questions are "How do I remove the brackets from the forum DB" as when I try to preview data in VWDE I get a message
Invalid object name 'tblArcade'.
I know its to do with this extra bit as it only happens to the tables that have this on the end... Hope that makes sense and someone can help me, if you could reply as if I'm really dumb it would be appreciated
 

View 4 Replies


ADVERTISEMENT

Newbie Needs Real Help

Feb 14, 2001

Hi. I am trying to setup php4 to talk to MSSQL 7, but am having no luck. Both are on a Win2k server. I get the error below. Please can someone tell me what to do, or even a step by step guide to setting up php to connect to a MSSQL7 database. I originally created the database in access 2000 and now want to use MSSQL to use it. This is the error i get:

Warning: MS SQL message: Could not locate entry in sysdatabases for database 'customers'. No entry found with that name. Make sure that the name is entered correctly. (severity 16) in C:Websiteewsiteestdb.php on line 13

Warning: MS SQL: Unable to select database: customers in C:Websiteewsiteestdb.php on line 13
Database unavailable

View 2 Replies View Related

Help For A Real Newbie

Oct 23, 2006

A problem so simple I'm a little embarrassed to post it... I am setting up a trigger in which I want to, among other things, record the network ID of the user who performs the action that triggers the trigger. I know there is a variable or function out there to pull that information, but I can't find it, and have tried every variation of "login logname usr_id network_id....." I can find.

So first.... could somebody please tell me the variable or function that will return that piece of information. And second, if you also could point me to a good place, either in print or on line, to look up that kind of information, I would be most grateful.



Thanks.

View 2 Replies View Related

Refering To Distinct Values Post(My Other Post)

Oct 22, 2007

---------------------------------------------------------------
My Original Post
I have to query n table(NLRImports) using the Distinct keyword, to retrieve a set of ID numbers. ( "Select DISTINCT id_nbr from NLRImport" ).

Now i want to use those values i retrieved, to process the records in the table(NLRImports) 1 by 1. How do i use those ID no's i retrieved as Variables or parameters for my next query?? If this makes sense?
----------------------------------------------------------------

First, thanks for the response.... now here is what im trying to do.
I created a simple application in delphi to import information to a table in MSSql2005. This is some of the resulting columns...

date | id_nbr | account_nbr | sub_account_nbr | ... etc
-------------------------------------------------------------

Now there will be several entries with the same id no but on different dates, so i take it dates would rather be my pkey.

Then i need to take one person's entries(i work on id_nbr) and go thru all the entries taking the earliest date and comparing all the other entries for that person to the first date and select all the dates more than 19 days after the first date and less than 91 days from first date and place it in a new table.
I used cursor s and while loops to kind of get it going but i know that cursors are not really recommended use but the performance implications dont bother with this particular job.

What other ways should i be using to accomplish this?

thanks, i hope this is clear...

View 1 Replies View Related

Newbie Here With A Newbie Error - Getting Database ... Already Exists.

Feb 24, 2007

Hi there
I sorry if I have placed this query in the wrong place.
I'm getting to grips with ASP.net 2, slowly but surely! 
When i try to access my site which uses a Sql Server 2005 express DB i am receiving the following error:

Server Error in '/jarebu/site1' Application.


Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'.Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:



[SqlException (0x80131904): Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.
Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735075
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
 
 This is the connection string that I am using:
 <connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;Initial Catalog=ASPNETDB;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
 
The database is definitly in the folder that the error message relates to.
What I'm finding confusing is that the connection string seems to be finding "aranga"s database.
Is it something daft?
 
Many thanks.
James 

View 1 Replies View Related

Post To A DB

May 25, 2006

Alright so here is what I am trying to do.
I have a form that someone fills out it has a text box as title, and a drop down box that is a category, and then a text area that is for their explanation.
On the back end I am using a stored procedure called sp_store_bkm. When I execute this it works just fine and puts the data that I put in it into the to table below is the  Stored procedure code:
ALTER PROCEDURE sp_store_bkm @oID nvarchar OUTPUT, @oTitle nvarchar(50),  @oCategory nvarchar(50), @obkmtext nvarchar(MAX)
 AS BEGIN INSERT INTO tbl_bkms(Title, Category, bkmtext) VALUES(@oTitle, @oCategory, @obkmtext)Set @oID=  SCOPE_IDENTITY() END
 
Now on my front end it comes up with an error in the lower left (erros on page). When I click on the error for details it seems like it is coming fromt he connection string. I cant find anything wrong with the connection string. Below is my code for the aspx page.
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script>
function Submit2_onclick() {
Dim Connection As SqlConnection = "server=localhost;Database=BKM.mdf;integrated security=SSPI;"        connection.Open()        Try            Dim command As SqlCommand = New SqlCommand("sp_store_bkm", connection)             command.CommandType = CommandType.StoredProcedure            Dim oID As New SqlParameter("@oID", SqlDbType.Int)            oID.Direction = ParameterDirection.Output             command.Parameters.Add(oID)            command.Parameters.Add("@oTitle", title.text)            command.Parameters.Add("@oCategory", category.text)            command.Parameters.Add("@obkmtext", bkmtext.text)            command.ExecuteNonQuery()             Dim sOrderID As String = oID.Value }</script>
<form method="post">    <table cellpadding="10" style="width: 100%">        <tr>            <td style="width: 100px">                <span style="font-size: 10pt; font-family: Verdana">                Login ID:                     <br />                </span>                <asp:LoginName ID="LoginName1" runat="server" Font-Names="Verdana" Font-Size="10pt" ForeColor="Red" />                <span style="font-size: 10pt; font-family: Verdana">                <br />                <br />                Title:<br />                </span>                <input id="title" style="width: 374px" type="text" /><br />                <br />                <span style="font-size: 10pt; font-family: Verdana">                Category:<br />                </span>                <select id="Category" name="D1" size="1" language="javascript" onclick="return Select1_onclick()">                    <option selected="selected">Office Applications</option>                    <option>VPN</option>                    <option>WLAN</option>                </select>                &nbsp; &nbsp;                &nbsp; &nbsp;<br />                <span style="font-size: 10pt; font-family: Verdana">                    <br />                Your BKM<br />                </span>                <textarea id="bkmtext" style="width: 378px; height: 196px"></textarea><br />                <br />                &nbsp;<input id="Reset1" type="reset" value="reset" />                &nbsp; &nbsp; &nbsp;<input id="Submit2" type="submit" value="submit" language="javascript" onclick="return Submit2_onclick()" /></td>        </tr>    </table>    </form></asp:Content>
 
Please help.

View 3 Replies View Related

HELP !!!!!! (just Below This Post)

Jul 12, 2001

Can you help me? I'm pointing on the thread just below this post (along with the other messages on the message board).

View 1 Replies View Related

Hello--First Post & Already Need Help!

Nov 7, 2007

Greetings friends:

I am a student at DePaul University in Chicago, IL. We have a big db project tomorrow and I'm proud with the work I've done so far, I've designed my own db and tested it using queries and such. Pretty good for being introduced to SQL just a couple short months ago. Anyway, I've sort of run into a wall here. I need to have an attribute of a table be computed from others.

I'm working with 2005 Server Management Studio and I have found the computed column specification under the column properties tab. I know that I have to enter a formula, but I'm just not sure on what to do. I have a CHG_HOUR attribute in a table called "EXPERTISE" which signifies how much a consultant charges per hour, based on what he exactly does. I also have a JOB_HOURS attribute in a JOB table (that links my CONTRACT table to CONSULTANT). I want to basically give a formula that multiplies the CHG_HOUR from the EXPERTISE table by the JOB_HOURS in the JOB table. Any suggestions on how I might do this?

Thank you in advance for your response, and hopefully with more practice and courses, I can be the one helping people like me on these boards in a few years.

View 2 Replies View Related

First Post

Jul 20, 2005

Just testing out this posting thing... Thanks!!Join Bytes!----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups---= East/West-Coast Server Farms - Total Privacy via Encryption =---

View 2 Replies View Related

Post SP2 GDR

Mar 8, 2007

I have a question about the post SP2 GDR that just came out in the last day or two. My laptop only has the client tools installed, not the server components (except for the SSIS server component). Is there any need for me to install this GDR? Does it impact the Management Studio code which views maintenance plans on remote SQL Servers or anything?

View 3 Replies View Related

Can Someone Help With This T-SQL Real Quick?

Nov 11, 2007

Hey guys... i cant figure this out for the life of me.  I have a long T-sql query, and when i enter the string "Rental" into the Listingtype, it says invalid column name "Rental" ... im not looking for the value to be a column, im looking for it to match the value in the ListingType column... here's the query:
 
 (

@StudioINT = NULL,
@Br1INT = NULL,
@Br2INT = NULL,
@Br3INT = NULL,
@Br4INT = NULL,
@OverBr4INT = NULL,
@CondoINT = NULL,
@ListingTypevarchar(10) = NULL,
@WindowAirINT = NULL,
@CentralACINT = NULL,
@BalconyDeckPatioINT = NULL,
@UseOfYardINT = NULL,
@DishwasherINT = NULL,
@WasherDryerINT = NULL,
@FireplaceINT = NULL,
@EIKINT = NULL,
@HardwoodFloorsINT = NULL,
@BroadbandNetINT = NULL,
@TVINT = NULL,
@ThermostatINT = NULL,
@LandlordNotPresentINT = NULL,
@SmokingINT = NULL,
@NoPetsAllowedINT = NULL,
@CatINT = NULL,
@MoreCatsINT = NULL,
@SmallDogINT = NULL,
@LargeDogsINT = NULL,
@DoorpersonINT = NULL,
@IngroundPoolINT = NULL,
@AboveGroundPoolINT = NULL,
@ElevatorINT = NULL,
@UseOfGarageINT = NULL,
@LaundryFacilitiesINT = NULL,
@HealthCenterINT = NULL,
@StorageAreasINT = NULL,
@WheelchairAccessINT = NULL,
@BusinessCentersINT = NULL,
@RentChargeMinINT = NULL,
@RentChargeMaxINT = NULL,
@DebugBIT = 1
)
AS

SET NOCOUNT ON

DECLARE @SQL VARCHAR(8000)

SET @SQL = '
SELECT

r.REListingID,
r.REListingDate,
r.Username,
r.ZipCode,
r.ListingType,
r.StudioFlag,
r.BRFlag1,
r.BRFlag2,
r.BRFlag3,
r.BRFlag4,
r.OverBRFlag4,
r.CondoFlag,
a.WindowAir,
a.CentralAir,
a.BalconyDeckPatio,
a.UseOfYard,
a.Dishwasher,
a.WasherDryer,
a.Fireplace,
a.EIK,
a.HardwoodFloors,
a.BroadbandNet,
a.TV,
a.Thermostat,
a.LandlordNotPresent,
a.Smoking,
a.NoPetsAllowed,
a.Cat,
a.MoreCats,
a.SmallDog,
a.LargeDogs,
a.Doorperson,
a.IngroundPool,
a.AboveGroundPool,
a.Elevator,
a.UseOfGarage,
a.LaundryFacilities,
a.HealthCenter,
a.StorageAreas,
a.WheelchairAccess,
a.BusinessCenters,
a.RentCharge,
a.RentFrequency
FROMdb_REListings as r
INNER JOINdb_RentalAmenities AS a ON a.REListingID = r.REListingID
WHERE1 = 1
'

IF @Studio IS NOT NULL
SET @SQL = @SQL + ' AND r.StudioFlag = ' + CONVERT(VARCHAR(20), @Studio)
IF @Br1 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag1 = ' + CONVERT(VARCHAR(20), @Br1)
IF @Br2 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag2 = ' + CONVERT(VARCHAR(20), @Br2)
IF @Br3 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag3 = ' + CONVERT(VARCHAR(20), @Br3)
IF @Br4 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag4 = ' + CONVERT(VARCHAR(20), @Br4)
IF @OverBr4 IS NOT NULL
SET @SQL = @SQL + ' AND r.OverBRFlag4 = ' + CONVERT(VARCHAR(20), @OverBr4)
IF @Condo IS NOT NULL
SET @SQL = @SQL + ' AND r.CondoFlag = ' + CONVERT(VARCHAR(20), @Condo)
IF @ListingType IS NOT NULL
SET @SQL = @SQL + ' AND r.ListingType = ' + CONVERT(char, @ListingType)
IF @WindowAir IS NOT NULL
SET @SQL = @SQL + ' AND a.WindowAir = ' + CONVERT(VARCHAR(20), @WindowAir)
IF @CentralAC IS NOT NULL
SET @SQL = @SQL + ' AND a.CentralAir = ' + CONVERT(VARCHAR(20), @CentralAC)
IF @BalconyDeckPatio IS NOT NULL
SET @SQL = @SQL + ' AND a.BalconyDeckPatio = ' + CONVERT(VARCHAR(20), @BalconyDeckPatio)
IF @UseOfYard IS NOT NULL
SET @SQL = @SQL + ' AND a.UseOfYard = ' + CONVERT(VARCHAR(20), @UseOfYard)
IF @Dishwasher IS NOT NULL
SET @SQL = @SQL + ' AND a.Dishwasher = ' + CONVERT(VARCHAR(20), @Dishwasher)
IF @WasherDryer IS NOT NULL
SET @SQL = @SQL + ' AND a.WasherDryer = ' + CONVERT(VARCHAR(20), @WasherDryer)
IF @Fireplace IS NOT NULL
SET @SQL = @SQL + ' AND a.Fireplace = ' + CONVERT(VARCHAR(20), @Fireplace)
IF @EIK IS NOT NULL
SET @SQL = @SQL + ' AND a.EIK = ' + CONVERT(VARCHAR(20), @EIK)
IF @HardwoodFloors IS NOT NULL
SET @SQL = @SQL + ' AND a.HardwoodFloors = ' + CONVERT(VARCHAR(20), @HardwoodFloors)
IF @BroadBandNet IS NOT NULL
SET @SQL = @SQL + ' AND a.BroadbandNet = ' + CONVERT(VARCHAR(20), @BroadbandNet)
IF @TV IS NOT NULL
SET @SQL = @SQL + ' AND a.TV = ' + CONVERT(VARCHAR(20), @TV)
IF @Thermostat IS NOT NULL
SET @SQL = @SQL + ' AND a.Thermostat = ' + CONVERT(VARCHAR(20), @Thermostat)
IF @LandlordNotPresent IS NOT NULL
SET @SQL = @SQL + ' AND a.LandLordNotPresent = ' + CONVERT(VARCHAR(20), @LandLordNotPresent)
IF @Smoking IS NOT NULL
SET @SQL = @SQL + ' AND a.Smoking = ' + CONVERT(VARCHAR(20), @Smoking)
IF @NoPetsAllowed IS NOT NULL
SET @SQL = @SQL + ' AND a.NoPetsAllowed = ' + CONVERT(VARCHAR(20), @NoPetsAllowed)
IF @Cat IS NOT NULL
SET @SQL = @SQL + ' AND a.Cat = ' + CONVERT(VARCHAR(20), @Cat)
IF @MoreCats IS NOT NULL
SET @SQL = @SQL + ' AND a.MoreCats = ' + CONVERT(VARCHAR(20), @MoreCats)
IF @SmallDog IS NOT NULL
SET @SQL = @SQL + ' AND a.SmallDog = ' + CONVERT(VARCHAR(20), @SmallDog)
IF @LargeDogs IS NOT NULL
SET @SQL = @SQL + ' AND a.LargeDogs = ' + CONVERT(VARCHAR(20), @LargeDogs)
IF @Doorperson IS NOT NULL
SET @SQL = @SQL + ' AND a.Doorperson = ' + CONVERT(VARCHAR(20), @Doorperson)
IF @IngroundPool IS NOT NULL
SET @SQL = @SQL + ' AND a.IngroundPool = ' + CONVERT(VARCHAR(20), @IngroundPool)
IF @AboveGroundPool IS NOT NULL
SET @SQL = @SQL + ' AND a.AboveGroundPool = ' + CONVERT(VARCHAR(20), @AboveGroundPool)
IF @Elevator IS NOT NULL
SET @SQL = @SQL + ' AND a.Elevator = ' + CONVERT(VARCHAR(20), @Elevator)
IF @UseOfGarage IS NOT NULL
SET @SQL = @SQL + ' AND a.UseOfGarage = ' + CONVERT(VARCHAR(20), @UseOfGarage)
IF @LaundryFacilities IS NOT NULL
SET @SQL = @SQL + ' AND a.LaundryFacilities = ' + CONVERT(VARCHAR(20), @LaundryFacilities)
IF @HealthCenter IS NOT NULL
SET @SQL = @SQL + ' AND a.Health Center = ' + CONVERT(VARCHAR(20), @HealthCenter)
IF @StorageAreas IS NOT NULL
SET @SQL = @SQL + ' AND a.StorageAreas = ' + CONVERT(VARCHAR(20), @StorageAreas)
IF @WheelchairAccess IS NOT NULL
SET @SQL = @SQL + ' AND a.WheelchairAccess = ' + CONVERT(VARCHAR(20), @WheelchairAccess)
IF @BusinessCenters IS NOT NULL
SET @SQL = @SQL + ' AND a.BusinessCenters = ' + CONVERT(VARCHAR(20), @BusinessCenters)
IF @RentChargeMin IS NOT NULL AND @RentChargeMAX IS NOT NULL
SET @SQL = @SQL + ' AND a.RentCharge BETWEEN ' + CONVERT(VARCHAR(20), @RentChargeMin) + ' AND ' + CONVERT(VARCHAR(20), @RentChargeMax)
IF @RentChargeMin IS NOT NULL AND @RentChargeMAX IS NULL
SET @SQL = @SQL + ' AND a.RentCharge >= ' + CONVERT(VARCHAR(20), @RentChargeMin)
IF @RentChargeMAX IS NULL AND @RentChargeMAX IS NOT NULL
SET @SQL = @SQL + ' AND a.RentCharge <= ' + CONVERT(VARCHAR(20), @RentChargeMax)

IF @Debug = 1
PRINT @SQL

EXEC (@SQL) 

View 5 Replies View Related

The REAL Problem

Oct 3, 2000

I was running a server with TempDB in RAM (please don't comment on why that's not a good idea). Well, everything was fine until one of our administrator install teh backup exec agent and restarted the server. Since then the server won't start giving an error the Tempdb coulld not be moved into ram. Well, I started the server using the -f parameter and reset the Tempdb in RAM setting to zero. Howeever, it still won't start and gives the same error about not being able to move Tempdb into RAM. Is my only option to rebuild the master database? This is just a backup server but I'd like to avoid the hassle of rebuilding master and reinitializing the databases.


--Buddy

View 4 Replies View Related

A Real SQL Mindblower

May 18, 2004

Hi,

I'm trying to work out how to extract the information that I need from a set of database tables and can't think of a way of doing it with SQL.

The database forms the basis for a diary/calendar system for part-time employees and has two tables:

- One is called 'Availability' and holds info on each available hour slot in the calendar. The table just has fields 'time' and 'date', where the time is an integer representing an hour and date is datetime. The calendar runs from 07.00 to 23.00 each day, so there could be 16 rows in 'Availability' for one day. If any part of a day is unavailable (i.e. the employee doesn't work then) there will be no corresponding rows in the table.

- The second table is 'Appointments', which holds details of appointments that the employee is booked for. The main fields are 'date', 'time' and 'duration' (integer for minutes). All appointments will cover a time span that is also covered by an available period, but they are not actually linked in any way.

I need an SQL query that will return all available time slots that start at least 60 minutes after any appointments have FINISHED and at least 120 minutes before any appointment STARTS.

Since there is no link between the 'Appointments' table and the 'Availability' table, I can't think of any way of doing this.

Any ideas?

View 8 Replies View Related

Real To Datetime - How To...?

Mar 5, 2007

Hi,I would like to convert real data type to datetime type. Example:I have a real data type which is: 23,613456 (23 hours and 0,613456). Iwould like to have it in hh:mm:ss format. How to do this? Can I useconvert/cas function?Thanks for helpRgdsMario

View 1 Replies View Related

Finding If A REAL Is LIKE '%[49]9'

Jul 20, 2005

Timings... sometimes there are almost too many ways to do the same thing.The only significant findings I see from all the below timings is:1) Integer math is generally fastest, naturally. Bigint math isn't muchslower, for integers that all fit within an integer.2) Converting float to varchar is relatively slow, and should be avoided ifpossible. Converting from integer to varchar or varchar to int is severaltimes faster.3) Most significantly, and less obvious, CASE expr WHEN .... recomputes exprfor each WHEN condition, unfortunately, and is the same speed (or perhapsslightly slower) as listing WHEN expr = value for each condition. Perhaps anindexed computed column (somehow materialized) would be advisable whenpossible to avoid repeated computations in CASE..WHEN expressions (if thathelps..).Note that if you divide by COUNT(*), most timings below are below onemicrosecond per row, so this all may not be very significant in mostapplications, unless you do frequent aggregations of some sort.COUNT(*) FROM [my_sf_table] = 477446 rowsThe result from each query = either 47527 or 47527.0Platform: Athlon 2000 XP w/512MB RAM, table seems to be cached in RAM, SQL2000, all queries run at least 3 times and minimum timings shown (msec).SRP is a REAL (4 bytes)Fastest ones are near the end.CPU SQL(ms)-- Convert to varchar (implicitly) and compare right two digits-- (original version -- no I didn't write it)4546 select sum(case right(srp,2)when '99' then 1 when '49' then 1 else 0 end)from sf-- Use LIKE for a single comparison instead of two, much faster-- Note that the big speedup indicates that-- CASE expr WHEN y then a WHEN z then b .-- recalculates expr for each WHEN clause2023 select sum(case when srp like '%[49]9' then 1 else 0 end)from sf-- Floating point method of taking a modulus (lacking fmod/modf)2291 select sum(case round(srp - 100e*floor(srp*.01e),0)when 99 then 1 when 49 then 1 else 0 end)from sf-- Round to nearest 50 and compare with 491322 select sum(case round(srp-50e*floor(srp*.02e),0)when 49 then 1 else 0 end)from sf-- Divide by 49 by multiplying by (slightly larger than) 1e/49e811 select sum(floor((cast(srp as integer)%50)*2.04082E-2))from sf-- Integer approach without using CASE731 select sum(coalesce(nullif(sign(cast(srp asinteger)%50-48),-1),0))from sf-- My original integer approach651 select sum(case cast(srp as integer)%100when 99 then 1 when 49 then 1 else 0 end)from sf-- Modulus 50 integer approach without CASE481 select sum((cast(srp as integer)%50)/49)from sf-- Modulus 50 integer approach460 select sum(case cast(srp as integer)%50when 49 then 1 else 0 end)from sf-- bigint without CASE531 select sum((cast(srp as bigint)%50)/49)from sf-- bigint with CASE521 select sum(case cast(srp as bigint)%50when 49 then 1 else 0 end)from sf-- get SIGN to return -1 or 0, then add 1-- much better than the coalesce+nullif approach500 select sum(sign(cast(srp as integer)%50-49)+1)from sf-- SIGN with BIGINT551 select sum(sign(cast(srp as bigint)%50-49)+1)from sfBTW, I know srp should be int to begin with for this to be faster... Okay,so...select cast(srp as int) srp into sf from [my_real_sf_table]720 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf339 select sum(1+sign(srp%50-49)) from sf310 select sum(srp%50/49) from sf300 select sum(case srp%50 when 49 then 1 else 0 end) from sfWhat if it were a char(7)?select cast(cast(srp as integer) as char(7)) srp into sf2 from[my_sf_table]801 select sum(case right(rtrim(srp),2) when '49' then 1when '99' then 1 else 0 end) from sf2717 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf2405 select sum(srp%50/49) from sf2391 select sum(case srp%50 when 49 then 1 else 0 end) from sf2How about varchar(7)?drop table sf2select cast(cast(srp as integer) as varchar(7)) srp into sf2 from[my_sf_table]581 select sum(case right(srp,2) when '49' then 1when '99' then 1 else 0 end) from sf2569 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf2LIKE is faster on VARCHAR than on CHAR columns...Apparently it has to effectively RTRIM the trailing spaces during the LIKEoperation.Is binary collation any faster?drop table sf2select cast(cast(srp as integer) as varchar(7))COLLATE Latin1_General_BIN srpinto sf2 from tbl_superfile561 select sum(case right(srp,2) when '49' then 1when '99' then 1 else 0 end) from sf2530 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf2Binary collation comparisons are slightly faster, though it's not a bigdifference (with just two characters being compared).662 select sum(case convert(binary(2),right(srp,2))when 0x3439 then 1 when 0x3939 then 1 else 0 end) from sf2-----------5037 select right(srp,2) srp,count(*) from my_sf_tablegroup by right(srp,2)order by right(srp,2)920 select cast(srp as int)%100 srp,count(*) from my_sf_tablegroup by cast(srp as int)%100order by cast(srp as int)%100---On the one hand, premature optimization can be a waste of time and energy.On the other hand, understanding performance implications of variousoperations can help write more efficient systems.In any case, an indexed computed column or one updated on a trigger couldvirtually eliminate the need for any of these calculations to be performed,except upon insertion or update, so maybe my comparisons aren't verymeaningful for most applications, considering we're talking about less than3 microseconds per row here worst-case.But the results remind me, some recommend avoiding Identity when it's notnecessary. I find Identity(int,1,1) to be a nice, compact surrogate key thatis useful for quick comparisons, grouping, etc, and so on. Also, it seemsmost appropriate as the primary key to all lookup tables in a star schema inOLAP data warehousing. (?) Of course, in some situations, it's notappropriate, particularly when having a surrogate key violates dataintegrity by allowing duplicates that would not be allowed with a properprimary key constraint, or when the surrogate key is completely redundantwith (especially a short) single-column unique key value that would be abetter selection as the primary key. With multi-column primary keys, I thinkit's sometimes convenient to have a surrogate Identity if only for INclauses that reference that identity column (though EXISTS can usuallyreplace those, so maybe that's a weak excuse for an extra column.)

View 4 Replies View Related

How Does The Real SQL String Look Like?

Aug 22, 2007

Hello,

I define the sql-query:

SELECT myColumn FROM myPersonsTable WHERE myColumn=@FirstName

then I declare some SqlParameters like:

SqlParameter par=new SqlParameter();
par.ParameterName="@FirstName";
par.Value="John";
mySqlCommand.Parameters.Add(par);

Showing the mySqlCommand.CommandString it will look like:
(A) SELECT myColumn FROM myPersonsTable WHERE myColumn=@FirstName
Is this the real string that is send to the Database (among with some hidden string "John")?...

...or does the real string which is send to the Database look like:
(B) SELECT myColumn FROM myPersonsTable WHERE myColumn='John'
???

If so, where can I retrieve that last string (B)?
Or is (A) the way 'transact sql' operates?

Henk

View 3 Replies View Related

Sa Real Login Name

Nov 8, 2006

Greetings,

I have a SQL Server 2000 database using Integrated Security. Users are added directly to the database from their domain name. In the Login section of the Security node in Enterprise Manager they show up as DomainNameUserName. I have four users that have the System Administrator database role. When I use the user function to get their user name they show up as dbo. Is there a way to get their actual domain user name?

Thanks.

View 3 Replies View Related

How Do I Post A Job To SQL From My Web Page.

Apr 27, 2007

I am developing an application using Visual Web Designer (language VB) with a SQL Server 2000 back end.
Within my logic I have a point where I want to say "Run SQL procedure GEDFinish".  GEDFinish can take several minutes, and I don't need to wait for it's results - it would be fine if it ran overnight.  I can easily check whether GEDFinish has run from the database, in situation where my application logic needs to know if it has already run.
Currently I only know how to run a procedure under the direct control of my web program, but with GEDFinish this fails due to timeouts.  (This will be worse in the production site). What I really want to do is to have my web program submit "Exec GEDFinish" to the SQL agent, and then forget about it.   It would be even better if I could build a script for the SQL agent, for example "EXEC GEDFinish Parameter=7"
Help!  How do I do this?
Thanks, Robert Barnes

View 6 Replies View Related

Need Help Except Help Regarding Sql Mail(second Post)

Mar 1, 2002

Sorry it is my second posting , I am trying to find answer to my problem


Hello everybody.
I have problem with mail

I have 3 servers
A) SQL2000 sp2 Standard edition 1024 MB memory
B) SQL2000 sp2 Standard edition 3072 MB memory
C) SQL2000 sp2 Enterprise edition 2048 MB memory


All servers use same mail profile and they all run under same account MYDomainsvcSql2000 for server and agent and connected to same mail server
1. server C run fine
2. servers A and B could stop mail service during the day and the only way to restart it is to open EM and retype password for Sql server account (it will force Server and agent restart)


Any idea ?

View 1 Replies View Related

Can Someone Post Something On Indexes?

Apr 7, 2004

it's been too long since I answer something on indexes and it shouldn't, indexes are a important part of SQL

View 3 Replies View Related

HTTP Post

Jun 21, 2004

Hi,

Is it possible to write a stored procedure which can post an XML file to a server using HTTP?

Thanks!

View 6 Replies View Related

Post SP4 Hotfix

Aug 21, 2007

Can anyone help me to get the hotfix SQL Server 2000 build 8.00.2215 ?
As i do not find any download link.

View 3 Replies View Related

How To Find Out My Post?

Feb 10, 2006

How to find out all my post in this forum?

View 2 Replies View Related

I Need To Delete A Post

Feb 5, 2007

I need to delete a post by particular date and time, what is the syntax for that. anybody help

Articles on various categories

View 7 Replies View Related

Where Do I Find All My Post

May 22, 2007

Hi, I am new to this forum and was wondering where i can see all my previous post? (i.e all the post i was ever involved in)

dallr

View 15 Replies View Related

Test Post

Aug 1, 2007

This is a test post

View 7 Replies View Related

From Previous Post

Sep 28, 2007

Ok so someone answered my last quesiton about finding what tables are in a Stored procedure. Is there an opposite of that. If I wanted to type in a table and it shows all the stored procedures that use that table.

View 3 Replies View Related

How To Write (post) To A Url

Jul 20, 2005

I am at a client that uses an xml form to email from java rather thansetup a true email server. Does anyone have any suggestions as to howms sql can write to the xml or maybe even call java or xml directly.This will be done as part of the error detecting process of various sqljobs in EM.Thanks,Mike--Posted via http://dbforums.com

View 1 Replies View Related

Where Should I Post Questions On Sql?

Jul 20, 2005

View 1 Replies View Related

Was This Post Helpful

Mar 20, 2007

If u get any solution then plz share knowledge with me because I am new in SQL

View 3 Replies View Related

Real Time Data

Jan 25, 2007

I currently have an application which retrieves stats from a SQL database that are updated throughout the day. My application updates every 3 seconds to retrieve these stats but I found that it's quite expensive to the server's CPU when there are several clients running my application. Are there any other methods for extracting the data that won't require so much CPU. The fact that the database is being hit so much isn't good either. I have already written a webservice hoping that this would improve things but I'm not sure it has.

View 3 Replies View Related

Get Real XML Execution Plan

Jul 9, 2007

 Hi,I want to access the real execution plan via my webapplication after I have executed an SQL statement. I know how to get the estimated execution plan:1 cmd.CommandText = "SET SHOWPLAN_XML ON";2 cmd.ExecuteNonQuery();3 4 cmd.CommandText = myStatement;5 SqlDataReader dataReader = cmd.ExecuteReader();6 7 String plan = String.Empty;8 9 while (dataReader.Read()) {10 plan += dataReader.GetSqlString(0).ToString();11 }12 13 cmd.CommandText = "SET SHOWPLAN_XML OFF";14 cmd.ExecuteNonQuery();I want do compare the estimated costs with the real costs of the same statement. If I change code line 1 an 13 to "SET STATISTICS XML [ON|OFF]" the string "plan" will contain the result of the submitted SELECT statement, but I just need to get the plan and not the result itself. Thanks in Advance,Dominik 

View 6 Replies View Related

Diff Between Float And Real

Jan 7, 2008

Hi All,
What is the difference betwen real and float datatype of SQL  server.
Please one exapmle for each.
The  real datatype is like a float except  that real can only store numbers.What does it mean: float can store even characters.
Thanks
Abdul
 
 
 

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved