Jump to content

Ms Sql Server Technology Discussions


9Pardhu

Recommended Posts

[quote name='SonyVaio' timestamp='1360106631' post='1303232186']
ee ques ki answers telistay evaraina chepara [b]True/False[/b] *****1.XML uses bcode, long commands embedded in quotes, to characterize data*******
****2.Storing XML data is becoming a big question as XML data becomes more prevalent****
****3.Application Programming Interfaces are more efficient than CGI scripts and are implemented as shared code or dynamic link libraries****
****4.A client/server configuration that has three layers (one client and two servers) has a three-tier architecture****
[/quote]

ivanni nee course home works questions aa endi.. ittantivi interview lo kuda adagaru va...

Link to comment
Share on other sites

[quote name='loveindia' timestamp='1360122321' post='1303232833']

ivanni nee course home works questions aa endi.. ittantivi interview lo kuda adagaru va...
[/quote]

avuna bhaya
naku telsinavi dorikinavi rasina, dorakanivi ikkada adugutunna
answers telustay chepava baa

Link to comment
Share on other sites

[b] SQL SERVER – Generate Random Values - Random Number Generator Script[/b]


[b]Random Number Generator[/b]
There are many methods to generate random number in SQL Server.

[b]Method 1 : Generate Random Numbers (Int) between Rang[/b]

[CODE]
---- Create the variables for the random number generation
DECLARE @Random INT;
DECLARE @Upper INT;
DECLARE @Lower INT
---- This will create a random number between 1 and 999
SET @Lower = 1 ---- The lowest random number
SET @Upper = 999 ---- The highest random number
SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
SELECT @Random
[/CODE]

[b]Method 2 : Generate Random Float Numbers[/b]

[CODE]SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )[/CODE]

[b]Method 3 : Random Numbers Quick Scripts[/b]

[CODE]
---- random float from 0 up to 20 - [0, 20)
SELECT 20*RAND()
-- random float from 10 up to 30 - [10, 30)
SELECT 10 + (30-10)*RAND()
--random integer BETWEEN 0
AND 20 - [0, 20]
SELECT CONVERT(INT, (20+1)*RAND())
----random integer BETWEEN 10
AND 30 - [10, 30]
SELECT 10 + CONVERT(INT, (30-10+1)*RAND())
[/CODE]

[b]Method 4 : Random Numbers (Float, Int) Tables Based with Time[/b]

[CODE]
DECLARE @t TABLE( randnum float )
DECLARE @cnt INT; SET @cnt = 0
WHILE @cnt <=10000
BEGIN
SET @cnt = @cnt + 1
INSERT INTO @t
SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )
END
SELECT randnum, COUNT(*)
FROM @t
GROUP BY randnum
[/CODE]

[b]Method 5 : Random number on a per row basis[/b]

[CODE]
---- The distribution is pretty good however there are the occasional peaks.
---- If you want to change the range of values just change the 1000 to the maximum value you want.
---- Use this as the source of a report server report and chart the results to see the distribution
SELECT randomNumber, COUNT(1) countOfRandomNumber
FROM (
SELECT ABS(CAST(NEWID() AS binary(6)) %1000) + 1 randomNumber
FROM sysobjects) sample
GROUP BY randomNumber
ORDER BY randomNumber
[/CODE]

[center]http://www.youtube.com/watch?feature=player_embedded&v=1d29ka0hHnc[/center]

Link to comment
Share on other sites

[quote name='loveindia' timestamp='1360122321' post='1303232833']

ivanni nee course home works questions aa endi.. ittantivi interview lo kuda adagaru va...
[/quote]
agreed

Link to comment
Share on other sites

[quote name='Kaarthikeya' timestamp='1360154618' post='1303234302']
[b] SQL SERVER – Generate Random Values - Random Number Generator Script[/b]


[b]Random Number Generator[/b]
There are many methods to generate random number in SQL Server.

[b]Method 1 : Generate Random Numbers (Int) between Rang[/b]

[CODE]
---- Create the variables for the random number generation
DECLARE @Random INT;
DECLARE @Upper INT;
DECLARE @Lower INT
---- This will create a random number between 1 and 999
SET @Lower = 1 ---- The lowest random number
SET @Upper = 999 ---- The highest random number
SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
SELECT @Random
[/CODE]

[b]Method 2 : Generate Random Float Numbers[/b]

[CODE]SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )[/CODE]

[b]Method 3 : Random Numbers Quick Scripts[/b]

[CODE]
---- random float from 0 up to 20 - [0, 20)
SELECT 20*RAND()
-- random float from 10 up to 30 - [10, 30)
SELECT 10 + (30-10)*RAND()
--random integer BETWEEN 0
AND 20 - [0, 20]
SELECT CONVERT(INT, (20+1)*RAND())
----random integer BETWEEN 10
AND 30 - [10, 30]
SELECT 10 + CONVERT(INT, (30-10+1)*RAND())
[/CODE]

[b]Method 4 : Random Numbers (Float, Int) Tables Based with Time[/b]

[CODE]
DECLARE @t TABLE( randnum float )
DECLARE @cnt INT; SET @cnt = 0
WHILE @cnt <=10000
BEGIN
SET @cnt = @cnt + 1
INSERT INTO @t
SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )
END
SELECT randnum, COUNT(*)
FROM @t
GROUP BY randnum
[/CODE]

[b]Method 5 : Random number on a per row basis[/b]

[CODE]
---- The distribution is pretty good however there are the occasional peaks.
---- If you want to change the range of values just change the 1000 to the maximum value you want.
---- Use this as the source of a report server report and chart the results to see the distribution
SELECT randomNumber, COUNT(1) countOfRandomNumber
FROM (
SELECT ABS(CAST(NEWID() AS binary(6)) %1000) + 1 randomNumber
FROM sysobjects) sample
GROUP BY randomNumber
ORDER BY randomNumber
[/CODE]

[center][media=]http://www.youtube.com/watch?feature=player_embedded&v=1d29ka0hHnc[/media][/center]
[/quote]

nee mail check cheskoo

Link to comment
Share on other sites

naa databse lo oka table undi, table lo 4 existing columns unnayi ahaa 4 long back create chesina
ipudu same table lo inkoka 4 columns add chedam antay error msg vastundi

[b]"********saving changes is not permitted. the changes you have made require the following tables to be dropped and re-created. you have either made changes to a table that can't be re-created or enabled the option prevent saving changes that require the table to be re-created************".[/b]

ee error msg vastundi, ila enduku vastundi?
new columns add cheyalantay table drop chesi recreate cheyamantundi endi?

ipudu nenu em cheyali?

Link to comment
Share on other sites

google lo ahaa error copy chestay idi vachindi
naa SSMS [b]Prevent saving changes that require the table re-creation [/b]check chesi undi, dani nenu uncheck chesina
ipudu save avutundi table after creating 4 new columns

but idi uncheck chesinanduku em ana pblm untadaa? scripting apudu or triggers appudu?

To change the [b]Prevent saving changes that require the table re-creation[/b] option, follow these steps:[list=1]
[*]Open SQL Server Management Studio (SSMS).
[*]On the [b]Tools[/b] menu, click [b]Options[/b].
[*]In the navigation pane of the [b]Options[/b] window, click [b]Designers[/b].
[*]Select or clear the [b]Prevent saving changes that require the table re-creation[/b] check box, and then click [b]OK[/b].
[/list]

Link to comment
Share on other sites

oka table ki enni timestamp datatype petochu?
nenu 2 columns ki datatype timestamp petutuntay error vastundi

[b]*****A table can only have one timestamp column. Because table 'tb1' already has one, the column 'tb2' cannot be added*****.[/b]

but naku ikkada table lo 2 timestamps undali ani condition undi so, nenu ipudu idi ela cheyali?
google lo ee error copy chestay, answer ravatledu :3D_Smiles_38:

Link to comment
Share on other sites

[quote name='SonyVaio' timestamp='1360179881' post='1303236259']
naa databse lo oka table undi, table lo 4 existing columns unnayi ahaa 4 long back create chesina
ipudu same table lo inkoka 4 columns add chedam antay error msg vastundi

[b]"********saving changes is not permitted. the changes you have made require the following tables to be dropped and re-created. you have either made changes to a table that can't be re-created or enabled the option prevent saving changes that require the table to be re-created************".[/b]

ee error msg vastundi, ila enduku vastundi?
new columns add cheyalantay table drop chesi recreate cheyamantundi endi?

ipudu nenu em cheyali?
[/quote]

goto ssms --> tools --> options --> designers on left pane

Induloo option untadi [b]prevent saving changes that require the table to be re-creation ani daani click chesi[/b]

[b]Then ok now try to add the fields. adding ayyaka malli option teeseyyi ok[/b]

Link to comment
Share on other sites

[quote name='DARLING...' timestamp='1360181096' post='1303236354']

goto ssms --> tools --> options --> designers on left pane

Induloo option untadi [b]prevent saving changes that require the table to be re-creation ani daani click chesi[/b]

[b]Then ok now try to add the fields. adding ayyaka malli option teeseyyi ok[/b]
[/quote]

idi vachindi bro
ipudu save avutundi table

nenu inkoka query post chesina, daniki answer reply ivava about timestamp query

Link to comment
Share on other sites

[quote name='DARLING...' timestamp='1360181096' post='1303236354']
goto ssms --> tools --> options --> designers on left pane

Induloo option untadi [b]prevent saving changes that require the table to be re-creation ani daani click chesi[/b]

[b]Then ok now try to add the fields. adding ayyaka malli option teeseyyi ok[/b]
[/quote]

[color=#000000][font=Arial,][size=4]A timestamp is not a datetime datatype as the name suggests. It is an internal value that is [i]relative[/i] to the server's clock, but an actual time cannot be derived from it's value. It is simply used to evaluate whether a row has been updated, [b]and thus a table can only have one column of this type[/b]. Thetimestamp syntax is actually deprecated and is now named [url="http://msdn.microsoft.com/en-us/library/ms182776.aspx"]rowversion[/url] which makes a lot more sense.[/size][/font][/color]
[color=#000000][font=Arial,][size=4]Given your column names (Start, End) I assume you are trying to store actual timestamps, and should instead be using datetime as your datatype.[/size][/font][/color]

Link to comment
Share on other sites

[quote name='DARLING...' timestamp='1360181493' post='1303236391']
[color=#000000][font=Arial,][size=4]A timestamp is not a datetime datatype as the name suggests. It is an internal value that is [i]relative[/i] to the server's clock, but an actual time cannot be derived from it's value. It is simply used to evaluate whether a row has been updated, [b]and thus a table can only have one column of this type[/b]. Thetimestamp syntax is actually deprecated and is now named [url="http://msdn.microsoft.com/en-us/library/ms182776.aspx"]rowversion[/url] which makes a lot more sense.[/size][/font][/color]
[color=#000000][font=Arial,][size=4]Given your column names (Start, End) I assume you are trying to store actual timestamps, and should instead be using datetime as your datatype.[/size][/font][/color]
[/quote]

bhaya, ardam kaledu
ipudu nenu idi ela solve cheyali chepavaa?

2 columns ki nenu datatype timestamp set cheyali endukantay naku ichina condition adi

okavela 2 columns ki datatype timestamp set chesukolem antay
[b]oka daniki time stamp set chesi inkoka daniki datetime datatypeset cheyocha?[/b]

Link to comment
Share on other sites

[quote name='SonyVaio' timestamp='1360180975' post='1303236348']
oka table ki enni timestamp datatype petochu?
nenu 2 columns ki datatype timestamp petutuntay error vastundi

[b]*****A table can only have one timestamp column. Because table 'tb1' already has one, the column 'tb2' cannot be added*****.[/b]

but naku ikkada table lo 2 timestamps undali ani condition undi so, nenu ipudu idi ela cheyali?
google lo ee error copy chestay, answer ravatledu :3D_Smiles_38:
[/quote]

Nice..interesting to know this

rendo daaniki DATETIME ichi chusava?

Link to comment
Share on other sites

[quote name='Kaarthikeya' timestamp='1360182194' post='1303236470']

Nice..interesting to know this

rendo daaniki DATETIME ichi chusava?
[/quote]

yaa rendoo daniki datetime ichina
save avutundi table

but maa proff condition ichindu, datatype timestamp ani

mari datetime ivochaa ledaa ani?

Link to comment
Share on other sites

[quote name='SonyVaio' timestamp='1360182886' post='1303236543']

yaa rendoo daniki datetime ichina
save avutundi table

but maa proff condition ichindu, datatype timestamp ani

mari datetime ivochaa ledaa ani?
[/quote]

date time icheyyi, you cannot give two time stamp datatypes

Link to comment
Share on other sites

×
×
  • Create New...