I am using SQLServer 2008. I have a table X with field Y that is a datetime format. In the WHERE statement of my query I only want to keep the rows where the date of field Y equals the current date. …
Tag: sql-server
How to set collation of a column with SQL?
Originally, I created my SQL Server database on a local computer. I set its collation to Latin1_General_CI_AI and everything worked well. When I moved the finished work to the web hosting SQL Server, I encountered problem: they use a different database collation. So what can I do now? To be more specific, I n…
Why database designers do not make IDENTITY columns start from the min value rather than 1?
As we know, In Sql Server, The IDENTITY (n,m) means that the values will start from n, and the increment value is m, but I noticed that all database designers make Identity columns as IDENTITY(1,1) , …
php starup sqlsrv unable to initialize module
I am trying to connect MSSQL to PHP. i am following this tutorial. Anyway after i added the dll files as described in that tutorial, i get the following warning. How can i solve this ? note:i have gone through this post but none helped. Answer Looks like you’ve tried to install the sqlsrv extension for …
PHP/MS SQL Server display sql server datetime
im trying to display date and time from MSSQL Server datetime table using PHP, the value from from SQL Server is datetime EX. 2012-08-20 06:23:28:214. Now i want to display it the exact result but it php displays it like this EX. Aug 20 2012 6:23AM. I Have tried to use strtotime but the milliseconds does not …
getting “No column was specified for column 2 of ‘d'” in sql server cte?
I have this query, but its not working as it should, when I run this, I am getting Msg 8155, Level 16, State 2, Line 1 No column was specified for column 2 of ‘d’. Can any one tell me what am I doing wrong? Also, when I run this, I get Msg 8155, Level 16, State 2, Line 1
Export database schema into SQL file
Is it possible in MS SQL Server 2008 to export database structure into a T-SQL file? I want to export not only tables schema but also primary keys, foreign keys, constraints, indexes, stored procedures, user defined types/functions. Also I don’t want the data to be present in this T-SQL file. Is there a…
alter column table and make default value to empty string
good day.. just want to ask, is it possible to alter a column table and make the default value to empty string.. i tried using this query, Alter Table Employee Alter Column sJobTitle Varchar(…
How to store historical records in a history table in SQL Server
I have 2 tables, Table-A and Table-A-History. Table-A contains current data rows. Table-A-History contains historical data I would like to have the most current row of my data in Table-A, and Table-A-History containing historical rows. I can think of 2 ways to accomplish this: whenever a new data row is avail…
Delete many records from table A and B with one FK to table B
I have 2 tables: A and B A contains the following columns: B contains the following: B has a reference to A from A_id column (FK) The question: I want to delete all records from table A that their checkpoint_id is less than X: But I can’t do it since “The primary key value cannot be deleted becaus…