How can we help you today? How can we help you today?

DateTime Column confusion

I have a policies table with the following fields:
PolicyID
Datetime

When I type in
select * from policies as P order by P.
after I type in P. I get a list of column names I select the DateTime column and get
P.P.[DateTime]
intead of P.[DateTime]

if I choose not to use P. and use [ctrl]+[space] to get a list of column selecting the DateTime column gives me
SELECT * FROM [dbo].[Policies] AS p, [dbo].[llt.[dateAdded](datepart, number, date)king] AS lt ORDER BY DATEADD

??

All I wanted was,

Select * from Policies as P order by P.[DateTime] desc

emails4me
emails4me
0

Comments

5 comments

  • Bart Read
    Seriously?!? It inserted all of that? That's extremely odd. Can we have a copy of your database schema please? Feel free to contact me direct on bartD0TreadATredHYPH3NgateD0Tcom.

    Which editor were you using btw?


    Thanks,
    Bart
    Bart Read
    0
  • emails4me
    Was using MS SQL Server Management Studio at the time.

    Sorry can't provide the schema for the database, but the SQL script is displayed correctly in Query Analyzer and incorrectly in MS SQL Server Management Studio

    It appears that SQL Prompt functions a bit differently between the two editors.
    emails4me
    0
  • Bart Read
    OK, thanks, we'll look into it.

    One last thing: you definitely only hit the code completion key (ENTER, SPACE, TAB etc) once in order to insert the currently selected candidate?


    Thanks,
    Bart
    Bart Read
    0
  • Bart Read
    I'd make one suggestion here as well. Go to SQL Prompt > Options and increase the auto-popup delay from 300 milliseconds to 500 milliseconds. This seems to make things work much better in SQL Server Management Studio.


    Thanks,
    Bart
    Bart Read
    0
  • emails4me
    Yes, I definitely used the enter/ tab key at the time. Will try increasing the auotpopup delay as suggested and see if that helps.

    emails4me
    emails4me
    0

Add comment

Please sign in to leave a comment.