When you create a new table in the database and you added a new column, having data-type of DateTimeOffset(7). What do you use as “Default Values or Binding” for this DateTimeOffset as default? Thanks..
I am in a situation where I need to do some comparison for some products that are in a shopping cart. The cart can have as many items as the user desires but the average over time is roughly 5-15 items per cart. My question is one about optimization/overhead. I need to check what department […]
This is what I have ID Name DateTime Value Group 1 Mark 1/1/2010 0 1 2 Mark 1/2/2010 1 1 3 Mark 1/3/2010 0 1 4 Mark 1/4/2010 0 2 40 Mark 1/5/2010 1 2 5 Mark 1/9/2010 1 2 6 Mark 1/6/2010 1 2 7 Kelly 1/1/2010 0 3 8 Kelly 1/2/2010 1 3 […]
I was reading an article at http://www.codeproject.com/Articles/561797/Top-20-exciting-features-of-SQL-Server-2012-Part-2#Featurenumber9(Revolution):-Powerview There I read Let’s say you have two sets of database user one programmers and the other DBA’s. The programmers should be able to fire insert, update and delete queries while DBA’s should be able to create database, backup and do maintenance related activities. But DBA’s should not […]
I have two tables in my sql server 2008 TOPIC(idtop,title,usercreated); COMMENT(idcom,content,idtop,usercom); In my delete account function, I have to delete all the topics created by that account and all the comments in each topic. So first, I have to delete all comments of all topics which created by an special user (usercreated) but I really […]
I need to query a table in an sql server, in which the Query results to be filtered between yesterday’s 5:00Pm to Today’s 5:00PM. But the Table contains Date and Time in seperate fields. Any help would be appreciated. Thanks
I am creating a table as follows: CREATE TABLE dbo.Test ( A int, B int ) GO INSERT INTO Test VALUES (1, 11) GO INSERT INTO Test VALUES (5, 55) GO INSERT INTO Test VALUES (4, 44) GO I have a query which converts this into XML as : SELECT A,B FROM Test ORDER BY […]
How can I retrieve the value from the following dynamic SQL and assign it to a variable? SET @SQLString = N’SELECT TOP 1 D’+CAST(DAY(@dateTime)AS varchar(MAX)) + ‘ FROM TabelForMonthCurrent’ + ‘ WHERE empContractID=’ + CAST(@pEmpContractID AS nvarchar(MAX)) + ‘ AND Year=’ + CAST(YEAR(@dateTime) AS nvarchar(MAX)) + ‘ AND Month=’ + CAST(MONTH(@dateTime) AS nvarchar(MAX))
I have a table like this: group id 1 10 1 11 1 12 2 13 3 14 I want to get back the first record of each group, so my table should return something like this: group id 1 10 2 13 3 14 What’s the best way to do this in SQL?
I want to generate Col A, Col B, Col C from my database SQL Server… I want to dynamically populate Col C base on the row above it Col C = ( Col A + Col B + Col C [Above] )… I draw an example incase my explanations wasnt clear enough Please Help…